Why are tuples immutable?

Jeremy Bowers jerf at jerf.org
Thu Dec 16 01:06:28 EST 2004


On Thu, 16 Dec 2004 00:56:50 -0500, Jeremy Bowers wrote:
> editing with the object representing the GUI widget; I actually give each
> editable object a guaranteed unique id on creation, never changed, and I
> define __eq__(self, other) as "return self is other". 

Before anybody asks why I don't use "id", I'm concerned that that is
implementation-specific and don't really care to rely on it. Plus I make
some limited use of the fact they can be a little more comprehensible than
memory addresses during debugging; "Link Object #4 pointing at Target #5"
is a hell of a lot easier on the eyes and memory than "Link Object
#-1208632020 pointing at Target #-1208631892" (I just pulled those numbers
as the id() of m1 and m2 from the previous post.) Along with a couple of
other things I use because I control the ids.



More information about the Python-list mailing list