Python built-in constants (built-in Constants) __python

Source: Internet
Author: User
Tags assert in domain

Base constant False True None notimplemented ellipsis __debug__ site module added constants quitcodenone exitcodenone Copyright license Credits

Basic Constants

There are only a few constants in the built-in domain name: False

[Boolean type] [1] The negative value assigned to the False keyword is illegal and can cause syntaxerror. true¶

The truth value of a Boolean type, which is illegal to assign to the True keyword, and can cause syntaxerror. None

[Nonetype] [2] A private value of type, none is frequently used to represent a missing value, that is, when the default parameter is not passed to the function. assigning to the None keyword is illegal and can cause syntaxerror. notimplemented

A special value returned by a binary-specific method (for example, eq(), Lt(), add(), rsub(), and so on) to represent an operation that is not achievable with other classes; for the same purpose, It may also be returned through an in-place (in-place) binary special method. Its truth is true (WTF).

Note: When notimplemented is returned, the interpreter will then attempt a reflection operation on another type, or some other fallback (dependent operator).
See for details [Implementing arithmetic operations][3] ellipsis

Most of this special value is used to combine slice syntax that is extended for user-defined container data types. __debug__

This constant is true if Python is not started with AN-O option. Also the Assert statement.
If Python does not start with the-o option, the constant is true, see the [assert][4] statement for details.

Note: The names of None, False, True, and __debug__ cannot be reassigned (assigning values, even property names, will throw SyntaxError), so they can be considered "true" constants. Add constant for site module

[Site] [5] Modules (modules that can be imported automatically at startup, unless given the-S command-line option) can add several constants to the built-in namespaces, which are useful for interactive parsing of shells, but should not be used in programs. quit (code=none) exit (Code=none)

When printing an object, print information such as use Quit () or ctrl-d to exit, and when the object is invoked, the systemexit is raised with the specified exit code. Copyright License credits

When you print the object, print the information as "Type license () to" license text, and when you call the object, display the corresponding text in the page style (one page at a time).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.