Steve Holden wrote: > daniel wrote: > > Martin v. Löwis wrote: > [...] > >>For some objects, "change the object" is impossible. If you have > >> > >>a = b = 3 > >> > >>then there is no way to change the object 3 to become 4 (say); > >>integer objects are "immutable". So for these, to make a change, > >>you really have to change the variable, not the value. > >> > > > > sounds reasonable, I tried tuple which is also immutable, it behaves > > the same as integers. > > > Well spotted. Tuples are indeed immutable, as are strings, unicode > strings, integers and floats.
But tuples can contain mutable objects. >>> a = (0, [1]) >>> a[1].append(2) >>> a (0, [1, 2]) -- http://mail.python.org/mailman/listinfo/python-list