Re: Coming In Python 3.15: Sentinel Values
Lawrence D’Oliveiro <[email protected]> Mon, 11 May 2026 06:24:32 -0000 (UTC)
| Newsgroups | comp.lang.python |
|---|---|
| Organization | A noiseless patient Spider |
| Message-ID | <[email protected]> |
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. Also, an “is” comparison fails if you should (inadvertently or otherwise) make a copy of your sentinel object.