Documentation
Trying class MySentinel(sentinel): ... raises:
TypeError: type 'sentinel' is not an acceptable base type
This restriction is intentional, PEP 661 specifies it via __init_subclass__, but the 3.15 docs for sentinel don't mention it.
Suggested addition: a short note mentioning that sentinel cannot be subclassed, and that Enum is the recommended approach when you need multiple related sentinels or behavioral customisation.
Context: raised in the PEP 661 discussion thread, where @JelleZijlstra confirmed this was worth documenting.
Linked PRs
Documentation
Trying
class MySentinel(sentinel): ...raises:This restriction is intentional, PEP 661 specifies it via
__init_subclass__, but the 3.15 docs forsentineldon't mention it.Suggested addition: a short note mentioning that
sentinelcannot be subclassed, and thatEnumis the recommended approach when you need multiple related sentinels or behavioral customisation.Context: raised in the PEP 661 discussion thread, where @JelleZijlstra confirmed this was worth documenting.
Linked PRs