On 2022-06-17 14:10, Jonathan Fine wrote:
Hi
Consider
>>> a, b, *_ = iter('abdef')
>>> a, b, None = iter('abdef')
File "<stdin>", line 1
SyntaxError: can't assign to keyword
If providing this feature is found to be a good idea, it might be better
to use 'None' or even a new keyword rather than '*'. Obvious benefits is
it avoids further overloading '*', reduces the opportunity for a
fat-fingers error, and a lazy eyes code review error. It's also easier
to check a source file for use of this new feature.
If you can't find a good keyword for this feature, then that would
suggest that it's not a good idea.
How about "..."?
>>> a, b, *_ = iter('abdef')
>>> a, b, ... = iter('abdef')
File "<stdin>", line 1
a, b, ... = iter('abdef')
^^^
SyntaxError: cannot assign to ellipsis here. Maybe you meant '=='
instead of '='?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/FHIHFP5ISDUBZVEVDUDTCHMB4WT22WRC/
Code of Conduct: http://python.org/psf/codeofconduct/