Hi,

Given a = [1, 2]

a.extend(a) makes a = [1,2, 1,2]

One might guess a.extend(a) would turn into an infinite loop.  It turns out 
here Python first gets all the items of `a' and then append them to `a', so the 
infinite loop is avoided.

My question is, is there any doc on the behavior of things like this?

Another related example might be:
a[:] = a
Hopefully Python first gets all the items on the *right* side and then assigns 
them to the left.

Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to