[Python-ideas] Star assignment in iterator way?
storchaka at gmail.com
Tue Nov 21 04:07:58 EST 2017
21.11.17 10:54, Kirill Balunov пише:
> Of course this version has drawbacks (the first that come to mind):
> 1. Will *b see change if rhs is some muttable sequence?
> 2. Will *b one way iterator or somethong like range?
> But still it seems to me that the "iterator way" has more useful
Your implementation iterates seq multiple times. But iterable unpacking
syntax works with an arbitrary iterable, and iterates it only once.
Changing the result of iterable unpacking will break existing code that
depends on the result been a list.
And you already have mentioned a question about mutable sequence.
If these conditions and restrictions suit you, you can use your
good_star_exp() in your code or share it with others. But the semantic
of iterable unpacking can't be changed.
More information about the Python-ideas