Recursion limit problems

elventear elventear at gmail.com
Mon May 14 15:07:06 EDT 2007


On May 14, 2:03 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar>
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!




More information about the Python-list mailing list