Booleans
Sub-Type of Int
- Beginner
- January 7, 2026
Explore how Python defines the Boolean type as a subtype of integer, where True and False correspond to integer values 1 and 0 respectively. Understand the distinction between value equality and object identity through practical examples, enabling you to better grasp Python’s data model and logic evaluation.
Bool as a sub-type of int
Bool is actually a subtype of int. This means that boolean values of True and False can be considered as specialized integer values. Therefore, True is equivalent to the integer 1 and False is equivalent to the integer 0.
For instance, Python will evaluate the following expression as True.
print(True == 1)
True == 1 evaluates to True in Python
However, although the values are considered equal, the identity in terms of object type is not the same. The identity operator (e.g., is) can be employed to check whether or not two objects are the same in terms of identity.
In the example below, True is 1 evaluates to False. So even if True and 1 have the same value, they are distinct objects with different identities.
print(True is 1)
True is 1 evaluates to False in Python
The following expression is evaluated as False.
In This Module