Re: Strange behaviour of __cmp__
[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 > False > > I
Strange behaviour of __cmp__
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 >>> x1x2 or x1http://mail.python.org/mailman/listinfo/python-list