GKRootWire
Dev Tools Why 'Zero-Cost' Value Classes Still Need Compiler HelpAI Z.ai Unmasked as Creator of Chart-Topping Ox Alpha ModelAI Robotics AI Models Are Finally Leaving Their 'GPT-2 Moment' BehindAI QueryStory Raises $6M to Make AI Answers TrustworthyAI Arga Labs raises $10M to fix how enterprise AI agents get trainedGadgets Startup Legato Exits Stealth With AI-Powered Hearing GlassesDev Tools Why 'Zero-Cost' Value Classes Still Need Compiler HelpAI Z.ai Unmasked as Creator of Chart-Topping Ox Alpha ModelAI Robotics AI Models Are Finally Leaving Their 'GPT-2 Moment' BehindAI QueryStory Raises $6M to Make AI Answers TrustworthyAI Arga Labs raises $10M to fix how enterprise AI agents get trainedGadgets Startup Legato Exits Stealth With AI-Powered Hearing Glasses
Dev Tools

Python's Built-In Constants Have Some Surprisingly Odd Rules

A deep dive into True, False, None, and friends reveals inconsistencies that trip up even experienced Python developers.

A recent write-up making the rounds on Hacker News digs into Python's small set of pre-declared constants — things like True, False, None, NotImplemented, and Ellipsis — and finds their behavior less consistent than most developers assume. Some are full-blown keywords baked into the language grammar, while others are just regular names bound in the builtins module, meaning they can technically be reassigned or shadowed in ways True and False cannot.

The piece walks through the history of how these constants evolved, including Python 2's messier treatment of True and False as ordinary variables, and why NotImplemented and Ellipsis get special singleton treatment despite feeling like second-class citizens compared to None.

It's a niche but well-liked post (66 points, lively discussion) because it touches a part of Python most people take for granted without ever reading the fine print.

Why it matters: Understanding which built-ins are truly protected versus merely conventional matters for writing robust code and debugging weird edge cases, especially in metaprogramming or when reviewing legacy Python 2-to-3 migrations. It's a good reminder that 'obvious' language primitives often have quirky historical baggage.

Sources: Hacker News