Steve Jorgensen writes:

 > 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,

This is already valid syntax with different semantics.  Given the
existence of islice, there's really no excuse for breaking this, if
this were the only way to implement your syntax I'd be a solid -1 (as
it is I'm a -0 perhaps maybe I don't know ;-).

I could imagine a token other than "*" being used for this to avoid
the potential confusion or typo between "a, * = x" and "a, *_ = x",
such as Ellipsis or even None.  (Both are currently "cannot assign to"
errors.)  The best list of use cases for ellipsis I've found in a
quick look is https://python.land/python-ellipsis, and I don't see any
gotchas for your syntax (with ellipsis instead of star) there, but I
also didn't look very hard, and didn't think about the walrus operator
which I guess is a potential gotcha generator.

Steve



_______________________________________________
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/HDMLI4AXBPYQNRO4I5ZOJ7RYATUZQ774/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to