On Mon, Nov 27, 2017 at 1:32 PM, Chris Angelico
On Tue, Nov 28, 2017 at 8:24 AM, Guido van Rossum
wrote: On Mon, Nov 27, 2017 at 1:18 PM, Greg Ewing
wrote:
Chris Angelico wrote:
The problem is that it depends on internal whitespace to distinguish it from augmented assignment;
Ah, didn't spot that. I guess the ellipsis is the next best thing then.
An alternative would be to require parens:
(x, y, *) = z
But that would have the same issue.
Is this problem really important enough that it requires dedicated syntax? Isn't the itertools-based solution good enough? (Or failing that, couldn't we add something to itertools to make it more readable rather than going straight to new syntax?)
I don't think there's much that can be done without syntax; the biggest problem IMO is that you need to tell islice how many targets it'll be assigned into. It needs some interpreter support to express "grab as many as you have targets for, leaving everything else behind" without stating how many that actually is. So the question is whether that is sufficiently useful to justify extending the syntax. There are a number of potential advantages and several competing syntax options, and this suggestion keeps coming up, so I think a PEP is warranted.
OK, that's reasonable, and at first blush the ellipsis proposal looks okay. My PEP queue for Python 3.7 is full though, so I would like to put this off until 3.8. -- --Guido van Rossum (python.org/~guido)