The order of iterable de-referencing in assignment?

Random832 random832 at fastmail.com
Wed Aug 24 10:10:14 EDT 2016


On Wed, Aug 24, 2016, at 07:17, Chris Angelico wrote:
> Objects/listobject.c:795
> 
>     /* Special cases:
>        1) lists and tuples which can use PySequence_Fast ops
>        2) extending self to self requires making a copy first
>     */

And, of course, it is a special case - a.extend(iter(a)) is enough to
break it.

Frankly I'm not sure why bother to implement it when anyone who
legitimately wants to do it can simply do a *= 2.



More information about the Python-list mailing list