why is self not passed to id()?

Fredrik Lundh fredrik at pythonware.com
Thu Sep 4 23:31:44 CEST 2008

Robert Kern wrote:

> Well, that's not entirely true. They need to be not mutated while they 
> are in the dictionary, certainly. At least not in ways that affect 
> equality testing. In this case, one would also have to override 
> list.__eq__ to also compare by identity, too. Then you could mutate the 
> lists to your heart's content and the dictionary wouldn't care.

at which point you'd start wondering if it wouldn't be more efficient to 
wrap the list in a light-weight class, instead of using subclassing.


More information about the Python-list mailing list