Re: Coming In Python 3.15: Sentinel Values
Jon Ribbens <[email protected]> Mon, 11 May 2026 07:13:10 -0000 (UTC)
| Newsgroups | comp.lang.python |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
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.