# PEP 661: Sentinel Values

**URL:** <https://discuss.python.org/t/pep-661-sentinel-values/9126>\
**Category:** PEPs\
**Created:** [June 6, 2021, 8:07am UTC](https://discuss.python.org/t/pep-661-sentinel-values/9126 "2021-06-06T08:07:06Z")\
**Posts on this page:** 1\
**Showing post:** 340

<div class="post-metadata">

**Author:** ![StelarDream](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/stelardream/32/35414_2.png) [@StelarDream](https://discuss.python.org/u/StelarDream)\
**Post date:** [April 28, 2026, 10:16pm UTC](https://discuss.python.org/t/pep-661-sentinel-values/9126/340 "2026-04-28T22:16:54Z")

</div>

Hi all, first post here ^^

I came across this PEP through a YouTube video covering upcoming 3.15 features, and since it was just accepted I figured it wasn’t too late to share a few thoughts. I haven’t read the full thread (337 posts is a lot!), so apologies if any of this has already been covered.

I’m not a CPython internals person, I mostly encounter sentinels from the typing side, as a way to express “this argument was not provided” in a signature.

**One small concrete thing first**

The [3.15 docs](https://docs.python.org/3.15/library/functions.html#sentinel) don’t mention the subclassing restriction at all. A user who tries `class MySentinel(sentinel): ...` gets a `TypeError` with no explanation and no pointer toward `Enum` as the grouped-sentinel alternative. Even if the ban stays for good reasons, that seems worth a documentation note regardless.

**On the subclassing restriction itself**

I didn’t find a rationale for the ` __init_subclass__ ` block anywhere, not in the PEP body, not in Rejected Ideas. The concern I can imagine is that `class MISSING(sentinel): ...` looks like a sentinel instance rather than a factory, which is fair. But the useful pattern doesn’t look like that:

```python
class FalsySentinel(sentinel):
    def __bool__ (self) -> bool:
        return False

MISSING = FalsySentinel("MISSING")

```

Lowercase name, explicit instantiation, the ambiguity mostly goes away. And ` __bool__ ` customisation was listed as a dropped feature in the PEP due to “added complexity,” but with subclassing it would just be… normal Python. No new API surface needed.

That said, I think I can see _why_ the ban might exist technically. The ` __init__ ` uses `sys._getframemodulename(1)` with a hardcoded frame depth to capture the calling module for pickling, and a `super(). __init__ ()` call from a subclass shifts that frame. That’s a real problem in pure Python. But since `sentinel` ships as a C builtin, that seems like something addressable at that level, which makes me genuinely unsure whether the ban reflects a considered design decision, or just that nobody needed subclassing badly enough to do the extra work.

I’d love to hear if that was actually discussed somewhere in the thread!

---

_[View the full topic](https://discuss.python.org/t/pep-661-sentinel-values/9126)._
