Hi,

I thought that x += ... was the same than x = x + ..., but today I have 
realized it is not true when operating with mutable objects.

In Python 3.3 or 2.7 IDLE (Windows) compare:
>>> a = [3]
>>> b = a
>>> a = a + [1]
>>> b
[3]

and
>>> a = [3]
>>> b = a
>>> a += [1]
>>> b
[3, 1]

Is this behaviour explained in the Python documentation? 

Thanking you in advance,
Bartolomé Sintes



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to