Tech & AI News
Hacker News

Python's pre-declared constants are kinda weird

Python has six pre-declared constants: True, False, None, __debug__, Ellipsis, and NotImplemented. True, False, and None are lexical tokens that cannot be accessed or modified via attribute syntax. __debug__ is a normal identifier that cannot be assigned or deleted but can be shadowed in builtins. Ellipsis and NotImplemented are regular built-in objects that may be reassigned in the global namespace, while the other four remain immutable in source code despite mutable entries in the builtins module.