
There has been a lot of detailed discussion recently on discuss.python.org regarding a proposed PEP (PEP 661) to provide a better solution to the issue of sentinel values in Python. Much of this conversation seems to be duplicating points that have already been discussed in that thread: https://discuss.python.org/t/pep-661-sentinel-values/9126.Notably, the issue of how to approach type-hinting sentinel values is one of the key points of discussion in the thread. Alex -------- Original message --------From: Carl Meyer <carl@oddbird.net> Date: 28/09/2021 04:22 (GMT+00:00) To: Eric Traut <eric@traut.com> Cc: typing-sig@python.org Subject: [Typing-sig] Re: Using Final to signify a singleton? On Mon, Sep 27, 2021 at 7:18 PM Eric Traut <eric@traut.com> wrote:Brett, is there a reason you don't want to use `None` as a sentinel? Can’t speak for Brett’s specific case, but I’ve more than once had cases where None could be a valid user-provided value for an argument, and thus a function-specific sentinel was needed. This pattern used to be pretty simple with `MISSING = object()`; typing makes it more complicated. Carl