Core Concept Mastery • Python Visual Series Module
In Python, a boolean (`bool`) represents one of two possible states: `True` or `False`. Booleans are essential for controlling the flow of a program, such as deciding whether a piece of code should run (using `if` statements). They are often the result of comparing values or evaluating conditions. Under the hood, Python treats `True` as `1` and `False` as `0`.
Python · Memory model
In CPython, booleans are special integer objects. There is only one True and one False, and every boolean variable points to one of these two singletons.
Python keeps exactly one False object in memory. Any variable set to False just points at this shared object.