[Python-ideas] How assignment should work with generators?
kirillbalunov at gmail.com
Tue Nov 28 14:44:51 EST 2017
2017-11-28 10:06 GMT+03:00 C Anthony Risinger <c at anthonyrisinger.com>:
> If not already considered, what if the RHS had to be explicitly unpacked?
> Something like:
> a, b, c = *iterator
> Which would essentially be:
> a, b, c = (*iterator,)
> This enables lazy assignment by default but `*` can force complete
> expansion (and exact matching) of the RHS.
While I find your suggestions very close to my vision and the initial
proposal, which I still like. I saw enough of the discussion to realize
that by now it is already impossible.
> It's a breaking change, but it does have a straightforward fix (simply
> wrap and unpack any relevant RHS
Although I have never used Python 2, the idea to distinguish fixed-sized
and something lazy, even for Python 4, reminds me of the transition from
str-unicode to the present state of affairs, but with much higher impact.To
be honest, I do not like some aspects of how Python 2 issue has been
resolved (especially bytes part) but it is another topic.
With kind regards, -gdg
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas