[Python-ideas] How assignment should work with generators?
greg.ewing at canterbury.ac.nz
Wed Nov 29 16:49:19 EST 2017
C Anthony Risinger wrote:
> Is __len__ a viable option now that __length_hint__ has been identified
> for hints?
No, I misremembered that feature, sorry.
But I still don't like the idea of changing behaviour
depending on whether the RHS "looks like" an iterator
I'm not sure how to explain why I feel that way, but
I think it's because the proposal would make the
behaviour depend on the presence or otherwise of a
method that's not actually used by the operation
being performed. Unpacking doesn't need to know the
length in advance, so it shouldn't care whether there
is a __len__ method.
More information about the Python-ideas