On Sat, 15 May 2021, 5:39 am Tal Einat, email@example.com wrote:
(snip useful feature summary)
The common `SENTINEL = object()` idiom fails #3, #4 and #5. This is
what I've been using for years, and I now think that it isn't good enough. This not having a nice repr is what started this thread.
I'd also personally prefer something simple, ideally without a new class or module.
The key advantage of a new base class is that it offers a way to communicate a shift in the recommended development idiom. "sentinel = object()" is entrenched enough that I would expect that only a "types.Sentinel" base class would stand a good chance of displacing it.
Why the "types" module? I don't think this is important enough to be a builtin type, and the types module is cheap to import, doesn't bring in many transitive dependencies, and the purpose of the new base class would be defining custom sentinel types with various desirable properties.