Using either * or / could lead to some odd inconsistencies where a missing space is very consequential, eg: x, / = foo # fine x, /= foo # syntax error? x / = foo # syntax error x /= foo # fine, but totally different from the first example. That said, the * syntax feels intuitive in a way that / doesn’t. I’d suggest: x, *… = foo This seems unambiguous and fairly self-explanatory. - Lucas On Sat, Jun 18, 2022 at 11:23 PM Steven D'Aprano <steve@pearwood.info> wrote:
On Fri, Jun 17, 2022 at 11:32:09AM -0000, Steve Jorgensen wrote:
That leads me to want to change the proposal to say that we give the same meaning to "_" in ordinary destructuring that it has in structural pattern matching, and then, I believe that a final "*_" in the expression on the left would end up with exactly the same meaning that I originally proposed for the bare "*".
Although that would be a breaking change, it is already conventional to use "_" as a variable name only when we specifically don't care what it contains following its assignment, so for any code to be affected by the change would be highly unusual.
Not so: it is very common to use `_()` as a function in internationalisation.
https://stackoverflow.com/questions/3077227/mercurial-python-what-does-the-u...
If we are bike-shedding symbols for this feature, I am a bit dubious about the asterisk. It already gets used in so many places, and it can be confused for `a, b, *x` with the name x lost.
What do people think about
first, second, / = items
where / stands for "don't advance the iterator"?
I like it because it reminds me of the slash in "No Smoking" signs, and similar. As in "No (more) iteration".
-- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/B2IIGM... Code of Conduct: http://python.org/psf/codeofconduct/