PEP 661: Sentinel Values

The line in the PEP that says:

The Sentinel class may not be sub-classed, to avoid the greater complexity of supporting subclassing.

is IMO the problem here. If the Sentinel class could be subclassed, people could simply create their own subclass with the boolean behaviour they wanted. But because it can’t be, people who don’t like the default have to write their own sentinel class.

Because of that, I’m in favour of customisable bool behaviour. I don’t have a use case myself for it, but enough people here have expressed a need for it that I think it’s important.

9 Likes