
Nov. 29, 2017
9:49 p.m.
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 or not. 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. -- Greg