[EMAIL PROTECTED] wrote:
> See the following...
> 
> 
>>>>class X(list):
> 
>       def __cmp__(self,anX):
>               print "comparing from",id(self)
>               return cmp(self.v,anX.v)
> 
> 
> 
>>>>x1=X()
>>>>x2=X()
>>>>x1.v=-1
>>>>x2.v=100
>>>>x1>x2
> 
> False
> 
>>>>x1<x2
> 
> False
> 
> I expected x1>x2 or x1<x2 were False and True respectively.

list.__lt__ and list.__gt__ are being used in preference to X.__cmp__. 
Override these methods.

-- 
Robert Kern
[EMAIL PROTECTED]

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter

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

Reply via email to