Skip to content
Tech News
← Back to articles

Python quirks: pre-declared constants like True, False, None behave inconsistently

read original get Fluent Python, 2nd Edition (Luciano Ramalho) → more articles
GoKawiil Brief

A developer analysis highlights that Python's six built-in constants—True, False, None, __debug__, Ellipsis, and NotImplemented—are implemented in inconsistent ways under the hood. True, False, and None are hardcoded as lexer keywords rather than resolved through normal name lookup, while __debug__ is a regular identifier that uniquely cannot be assigned to, even as an attribute.

Why It Matters

GoKawiil's interpretation of the reporting above, not reported fact.

These inconsistencies reveal how Python's language design has accumulated special cases over time rather than following a single unified rule for identifiers and constants. For developers debugging unusual SyntaxError or AttributeError messages involving these tokens, understanding this quirky implementation history explains behavior that otherwise seems arbitrary.

Key Takeaways
Worth a Look

Fluent Python, 2nd Edition (Luciano Ramalho) — If quirks like Python's keyword-level True/False/None and the oddities of __debug__ and Ellipsis fascinate you, this book digs into exactly that kind of language internals. Fluent Python walks through the data model, name resolution, and idiomatic tricks that explain why Python behaves the way it does.

See Fluent Python, 2nd Edition (Luciano Ramalho) on Amazon → Affiliate link — we may earn a commission on purchases, at no extra cost to you. Product picked by AI based on this article; it is not a tested recommendation.

Source: sebsite.pw, 2026-08-25

Published there as: “Python's pre-declared constants are kinda weird”

Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.