For those times when a simple “None” marker element is not sufficient, this will be very convenient.
Lawrence D’Oliveiro <ldo@nz.invalid> writes:
For those times when a simple “None” marker element is not
sufficient, this will be very convenient.
object() has always worked for me.
On Sun, 10 May 2026 21:01:00 -0700, Paul Rubin wrote:
Lawrence D’Oliveiro <ldo@nz.invalid> 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.
A new feature coming in Python 3.15 is the “sentinel” class, useful
for creating custom values to mark the end of sequences of items, that
kind of thing
<https://docs.python.org/3.15/library/functions.html#sentinel>, <https://peps.python.org/pep-0661/>.
For those times when a simple “None” marker element is not sufficient, this will be very convenient. <SNIP>
On 5/10/26 19:17, Lawrence D’Oliveiro wrote:
A new feature coming in Python 3.15 is the “sentinel” class, useful
for creating custom values to mark the end of sequences of items, that
kind of thing
<https://docs.python.org/3.15/library/functions.html#sentinel>,
<https://peps.python.org/pep-0661/>.
For those times when a simple “None” marker element is not
sufficient, this will be very convenient.
Forgive me, but this smells of Feeping Creaturism to solve a not
very important question at the expense crufting up the language and decreasing clarity.
Oh well, there's an opportunity here for someone to excise the noisy
PEPs and create Python Lite.
On Mon, 11 May 2026 19:51:21 -0500, Tim Daneliuk wrote:
On 5/10/26 19:17, Lawrence D’Oliveiro wrote:
A new feature coming in Python 3.15 is the “sentinel” class, useful
for creating custom values to mark the end of sequences of items, that
kind of thing
<https://docs.python.org/3.15/library/functions.html#sentinel>,
<https://peps.python.org/pep-0661/>.
For those times when a simple “None” marker element is not
sufficient, this will be very convenient.
Forgive me, but this smells of Feeping Creaturism to solve a not
very important question at the expense crufting up the language and
decreasing clarity.
In order to be forgiven, you will have to explain why you think so.
Some of us have done enough Python programming that we can see the
utility of such a feature, minor as it is.
Tim Daneliuk <info@tundraware.com> writes:
Oh well, there's an opportunity here for someone to excise the noisy
PEPs and create Python Lite.
https://micropython.org
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,116 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 291:29:56 |
| Calls: | 14,323 |
| Calls today: | 1 |
| Files: | 186,347 |
| D/L today: |
10,919 files (3,247M bytes) |
| Messages: | 2,528,960 |