WeSearch

PEP 661: Sentinel values, has been accepted 5 years later

·14 min read · 0 reactions · 0 comments · 15 views
#python#programming#software development#pep#sentinel values
PEP 661: Sentinel values, has been accepted 5 years later
⚡ TL;DR · AI summary

PEP 661, which introduces a built-in class for defining sentinel values in Python, has been accepted and marked as final for Python 3.15. The proposal aims to address limitations in existing sentinel value implementations, such as uninformative repr outputs and issues with copying or pickling. The new sentinel() built-in class and PySentinel_New() C API function will standardize sentinel usage in the standard library and user code.

Key facts
Original article
Python Enhancement Proposals (PEPs)
Read full at Python Enhancement Proposals (PEPs) →
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).

Anonymous · no account needed
Share 𝕏 Facebook Reddit LinkedIn Threads WhatsApp Bluesky Mastodon Email

Discussion

0 comments