I suppose I'm hoping for some variant of the Use class objects rejected idea from the PEP: define your own specific sentinel class, which subclasses a Sentinel base class, or has a Sentinel metaclass. The base class would be responsible for providing the __repr__ and __str__ implementations. Then, one uses the specific subclass as the sentinel, and it can be easily type checked. So, ideally, something like:
class MySentinel(Sentinel):pass
While I like the sentinel() function syntax better as it's shorter and matches more what is currently done (i.e. Sentinel = object()), using a subclass would have the advantage of immediately working with all type checkers.
- Sebastian