[Python-ideas] How assignment should work with generators?
greg.ewing at canterbury.ac.nz
Thu Nov 30 17:26:02 EST 2017
Steven D'Aprano wrote:
> On Wed, Nov 29, 2017 at 07:33:54PM +0000, Steve Barnes wrote:
>>Just a thought but what about a syntax something along the lines of:
>>a, b, *remainder = iterable
>>Where remainder becomes the iterable with the first two values consumed
>>by assigning to a & b.
> Guido's time machine strikes again. That has worked since 3.3 if not
This is not quite the same thing -- the rest of the items
are extracted and put in a new list. I think Steve Barnes is
suggesting that the iterator should be left alone and
bound to the * target instead.
That would be an incompatible change.
More information about the Python-ideas