bladedpenguin wrote:

> So, in general, is it more efficient to use a dictionary or to override
> the __eq__ function?

Rule of thumb: If you want to add/remove arbitrary objects from a
collection a dictionary (or set) is always faster than a list. 

You may still have to override the __eq__() and __hash__() methods whenever
you have distinct objects that can be equal. Caveat: don't use dictionaries
if the result of

obj1 == obj2 # items in the dict

can change during the lifetime of the collection.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to