Re: Recursion limit problems

2007-05-15 Thread Gabriel Genellina
En Tue, 15 May 2007 09:28:52 -0300, Diez B. Roggisch <[EMAIL PROTECTED]> escribió: >> 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!=

Re: Recursion limit problems

2007-05-15 Thread Diez B. Roggisch
> 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. No, it won'

Re: Recursion limit problems

2007-05-14 Thread elventear
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 (_

Re: Recursion limit problems

2007-05-14 Thread elventear
On May 14, 1:20 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > Dicts first compare hashes and if they are equal, then check equality. If > two unequal strings have the same hash value, as is possible of course > (given only 2**32 possible hashes and many more possible strings), both can > still

Re: Recursion limit problems

2007-05-14 Thread Gabriel Genellina
En Mon, 14 May 2007 12:35:16 -0300, elventear <[EMAIL PROTECTED]> escribió: > Since I am defining a hash for my object, it makes sense that I should > be able to define equality. But I am not sure about inequality, in my > specific case. The paragraph above mentions that __cmp__ should be > defi

Re: Recursion limit problems

2007-05-14 Thread Terry Reedy
"elventear" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On May 12, 12:25 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 11 May 2007 19:17:57 -0300, elventear <[EMAIL PROTECTED]> > escribió: > "The only required property is that objects which compare equal have the >

Re: Recursion limit problems

2007-05-14 Thread elventear
On May 12, 12:25 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Fri, 11 May 2007 19:17:57 -0300, elventear <[EMAIL PROTECTED]> > escribió: > "The only required property is that objects which compare equal have the > same hash value; it is advised to somehow mix together (e.g., using

Re: Recursion limit problems

2007-05-14 Thread elventear
On May 11, 11:54 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > > Without seeing the full code and the exception traceback, my guess is that > your __hash__ somehow calls itself due to a refence loop in your object. A > simple example of a loop: > a = []; a.append(a) > Now, list objects are not ha

Re: Recursion limit problems

2007-05-11 Thread Gabriel Genellina
En Fri, 11 May 2007 19:17:57 -0300, elventear <[EMAIL PROTECTED]> escribió: > I am runing into recursion limit problems. I have found that the > culprit was related to the __hash__ function that I had assigned to > the objects that were added to a set. As T. Reedy said, probably you have a recu

Re: Recursion limit problems

2007-05-11 Thread Terry Reedy
"elventear" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | Hello everyone, | | I am runing into recursion limit problems. I have found that the | culprit was related to the __hash__ function that I had assigned to | the objects that were added to a set. | | Basically my __hash__ fu