On May 14, 2:03 pm, "Gabriel Genellina" <[EMAIL PROTECTED]>
wrote:
>
> Dicts and sets use the key's hash value to determine the "bucket" where  
> the key will be placed, and == to distingish between different objects  
> with the same hash value.
> That is, you should define __hash__ and one of (__cmp__ or __eq__).  
> __neq__ (inequality) isn't required nor used by dict/set implementation.  
> (Anyway, Python will transform a!=b into not(a==b), if __neq__ isn't  
> defined). Neither <, <=, >, >= are used.
> The important thing is that, if two objects compare equal, they must have  
> the same hash value. That is: (a==b) => (hash(a)==hash(b)) (the reciprocal  
> is not true).

Cool! I think this answers my last question.

Thanks!

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

Reply via email to