I can't say that I like the look of pseudo-assignment to question mark:
for ? in range(20):
...
but I could probably learn to live with it. But one of your
rationalisations:
> and makes it more obvious that
> the actual intent is for the value to be unused -- since it is entirely
> impossible to use it.
is actually an anti-feature, in my opinion.
I think that people might like the idea of not actually binding a value
in situations like this:
a, *?, b = expression
until you end up with something unexpected in a and b and need to debug
what it going on, either in a debugger or with print:
a, *?, b = expression
print(?) # wait this doesn't work;
I'm not sure how this is different than, say,
a, _, _ = range(3)
print(_)
or
a = range(3)[0]
print(<whatever the second value is>)
That is to say, some things are impossible; if you want to print the value, don't assign to '?'.
In my opinion, having a convention to treat certain variables as
"unused" is great (I'm partial to `__` myself, to avoid clobbering the
special variable `_` in the REPL). But having that be a pseudo-variable
which is *actually* unused and unuseable strikes me as being an
attractive nuisance.
--
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/OPUUJWBCK37CQXOYIFYSUIXFQSWTTCCA/
Code of Conduct: http://python.org/psf/codeofconduct/