always the same object
Jeff Epler
jepler at unpythonic.net
Tue Jan 20 18:50:36 EST 2004
If you included some code, maybe we'd be able to help you.
>>> struct.unpack("2i", " "*8)
(538976288, 538976288)
struct.unpack returned a tuple. The tuple happens to be immutable, and
all the things it contains are immutable. So there's no way to change
ever change the value of this object. As far as I know, this would be
true for any struct format you care to choose.
(You could change the "value" of an immutable object if it contains some
mutable objects, like this:
a = ([],)
b = ([],)
assert a == b
a[0].append(0)
assert a != b
a and b go from equal to unequal, even though a and b are both
immutable)
Jeff
More information about the Python-list
mailing list