Hi,

I'm the author of PEP 661: Sentinel Values. Here's a direct link to the PEP.

There was indeed a significant thread about this here on typing-sig (also mentioned in a previous message in this thread).

The current status of the PEP is that it's stalled due to me not finishing it. I got caught up in the typing discussion, largely due to not having much previous experience with Python typing, and failed to come to a clear conclusion of what a good solution would be.

> Even if I define a class just for this use-case, it still won't type check since the class that is instantiated once will still not be an iterable.

I wasn't aware that this could be an issue. If you could explain in more detail what the problem is, that could be helpful.

 - Tal Einat

On Tue, Sep 28, 2021 at 8:07 PM Guido van Rossum <guido@python.org> wrote:
Thanks for the pointer. A quick look didn't find anything in the PEP (661) about types, and the thread you linked to is too long to read in its entirety. Can someone summarize what they ended up deciding?

On Tue, Sep 28, 2021 at 8:41 AM Alex Waygood <alex.waygood@gmail.com> wrote:
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>
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