PEP 661: Sentinel values, has been accepted 5 years later
Unique placeholder values, commonly known as “sentinel values”, are common in programming. They have many uses, such as for:
Opening excerpt (first ~120 words) tap to expand
PEP 661 – Sentinel Values PEP 661 – Sentinel Values Author: Tal Einat <tal at python.org>, Jelle Zijlstra <jelle.zijlstra at gmail.com> Discussions-To: Discourse thread Status: Final Type: Standards Track Created: 06-Jun-2021 Python-Version: 3.15 Post-History: 20-May-2021, 06-Jun-2021 Resolution: 23-Apr-2026 Table of Contents Abstract Motivation Rationale Specification Typing C API Backwards Compatibility How to Teach This Security Implications Reference Implementation Rejected Ideas Use NotGiven = object() Add a single new sentinel value, such as MISSING or Sentinel Use the existing Ellipsis sentinel value Use a single-valued enum A sentinel class decorator Using class objects Define a recommended “standard” idiom, without supplying an implementation Use a new standard library module Use…
Excerpt limited to ~120 words for fair-use compliance. The full article is at Python Enhancement Proposals (PEPs).