I had a minor typing questions while reading the new documentation and the PEP:
The PEP states
If the name passed to
sentinel()does not match the name the object is assigned to, type checkers should emit an error.
but in the example in the documentation, we have this:
class Cls:
PICKLABLE = sentinel("Cls.PICKLABLE")
assert pickle.loads(pickle.dumps(Cls.PICKLABLE)) is Cls.PICKLABLE
which seemingly breaks the above rule. However, it does seem nicer to write "Cls.PICKLABLE" here (and in fact, this seems to be needed for correct pickling), so maybe the typing spec can be formulated to allow this. (Or even require prefixing the class name if a sentinel is defined in a class?)