This guide explains Built-In Constants: True, False, None, Ellipsis, and NotImplemented through a focused example and practical reasoning. No prior knowledge of this specific operation is required.
Understanding the Concept
True and False are Boolean constants; None represents the absence of a value; Ellipsis is the object written ...; and NotImplemented tells Python’s binary-operation dispatch that a particular operation is unsupported. These objects are not interchangeable.
When You Would Use This
A function can return None when no result has been found.
Step-by-Step Example
result = None
print(result is None)
print(True + 1)
print(Ellipsis is ...)
print(NotImplemented is None)
How the Example Works
The outputs are True, 2, True, and False. Although bool is a subclass of int, using Boolean values as numbers is usually less readable.
Example Output
True
2
True
False
Try It Yourself
Create a function that returns a name or None and check the result using is None.
Common Beginner Mistakes
- Using
NotImplementedas if it wereNotImplementedError. - Treating
None,False,0and an empty string as the same semantic state. - Using
...as though it automatically provides a real implementation of a function.
Key Takeaways
TrueandFalseare Boolean constants;Nonerepresents the absence of a value;Ellipsisis the object written...; andNotImplementedtells Python’s binary-operation dispatch that a particular operation is unsupported.- The outputs are
True,2,True, andFalse. - Avoid this mistake: Using
NotImplementedas if it wereNotImplementedError.