GKRootWire
Cloud & Sysadmin Microsoft Confirms Preview Update Wipes Out Desktop SettingsAI Nvidia to Acquire Hugging Face for $12.9 BillionDev Tools A Deep Dive Into Intrusive Linked ListsGadgets DJI's Romo 2 Robovac Adds Local-Only Mode After Privacy ScareAI Nvidia Reportedly Moves to Acquire Hugging FaceAI Anthropic Launches Claude Tools for AI Shopping AgentsCloud & Sysadmin Microsoft Confirms Preview Update Wipes Out Desktop SettingsAI Nvidia to Acquire Hugging Face for $12.9 BillionDev Tools A Deep Dive Into Intrusive Linked ListsGadgets DJI's Romo 2 Robovac Adds Local-Only Mode After Privacy ScareAI Nvidia Reportedly Moves to Acquire Hugging FaceAI Anthropic Launches Claude Tools for AI Shopping Agents
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