Keywords and Expressions

True — Boolean constant

True is the built-in Boolean value representing logical true. It is a singleton of type bool and cannot be reassigned. Because bool is a subclass of int, True compares equal to 1, although their exact types differ. Use Boolean values for predicates and flags; do not confuse strings containing Boolean words with Boolean objects. Identity checks are usually unnecessary for ordinary truth testing.

Formal Syntax & Structure

python syntaxpython
True

Return Value

bool

The singleton Boolean value True.

Working Example

Example Snippetpython
print(True)print(type(True).__name__)print(int(True))print(not True)
Python Reference