The more I think about it, the more I'm inclined to find an implementation that would require no special support from type checkers. That is, an implementation which would allow existing type analysis to "just work". But it seems that would be impossible with an interface of the form currently suggested in the PEP, `NotGiven = sentinel('NotGiven').`
I honestly think that requiring type checkers to special case this is fine. All implementations that would work with the existing type system are a bit awkward to use. In my opinion the type system should serve the language, but the language shouldn't be constrained by it. (Although often when something doesn't work within the type system, it's an indication that it might not be the best/clearest solution. Sentinels are special enough to earn special treatment.) The only thing that I think would help the typing case is having a Sentinel base class as I mentioned in the discuss thread. This allows us to write functions that accept arbitrary sentinels (for whatever reason) in a type-safe manner.
- Sebastian