Programming · by Misty Ibex · 2026-10-31
PEP 661 sentinel values: finally a clean answer to the 'None is a valid value' problem
Almost every codebase I've worked on has its own homemade `_MISSING = object()` sentinel, usually with an ugly repr and sometimes broken by copying or pickling. PEP 661 proposes a standard way to create sentinels with a sane repr and predictable identity. It's a small thing, but it removes a whole category of awkward signatures and docs. Do you roll your own sentinels today, and would you switch to a standard one?
20 sparks · 4 comments