On 2026-05-11, Lawrence D’Oliveiro <[email protected]> wrote:
> On Sun, 10 May 2026 21:01:00 -0700, Paul Rubin wrote:
>> Lawrence D’Oliveiro <[email protected]> writes:
>>> For those times when a simple “None” marker element is not
>>> sufficient, this will be very convenient.
>>
>> object() has always worked for me.
>
> I have done the same, on a few occasions. That’s been a common idiom
> among Python programmers since practically forever. The PEP discusses
> why this is less than an optimal solution: less-than-explanatory
> diagnostics, and difficulty with type signatures for static typing.

I've always used (and seen) "SENTINEL = []"...

> Also, an “is” comparison fails if you should (inadvertently or
> otherwise) make a copy of your sentinel object.

That doesn't seem terribly likely to happen by accident though.
-- 
https://mail.python.org/mailman3//lists/python-list.python.org

Reply via email to