[Python-ideas] How assignment should work with generators?
Koos Zevenhoven
k7hoven at gmail.com
Mon Nov 27 10:23:31 EST 2017
On Mon, Nov 27, 2017 at 4:50 PM, Kirill Balunov <kirillbalunov at gmail.com>
wrote:
>
> I really do not like to use "starred" targets in any way:
>
> x, y, * = iterable
>
This one won't work, because it looks like in-place multiplication
(__imul__) which clashes with the above for a single name as assignment
target:
x *= 2 # "x = x * 2"
> x, y, *...
>
> Because any "starred" target implies consuming or collecting, and
> contradicts with the proposed behavior.
>
>
Consuming does not contradict with your proposal, but maybe you mean *fully
consuming*. I think you are proposing partial or incremental consumption of
the rhs.
—Koos
--
+ Koos Zevenhoven + http://twitter.com/k7hoven +
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171127/2fedab31/attachment.html>
More information about the Python-ideas
mailing list