Python interpreter bug

Fredrik Lundh fredrik at pythonware.com
Fri Oct 7 09:34:45 EDT 2005


alainpoint at yahoo.fr wrote:

> I came accross what i think is a serious bug in the python interpreter.

> Membership testing seems not to work for list of objects when these
> objects have a user-defined __cmp__ method.

it does not work if they have *your* __cmp__ method, no.  if you add
a print statement to the method, you'll figure out why:

        def __cmp__(self,other):
            print "CMP", other.allocated, self.allocated
            return cmp(other.allocated,self.allocated)

</F> 






More information about the Python-list mailing list