why is self not passed to id()?

Robert Kern robert.kern at gmail.com
Thu Sep 4 17:37:04 EDT 2008


Fredrik Lundh wrote:
> 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.

Fair point.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco




More information about the Python-list mailing list