__cmp__ behaviour
Emile van Sebille
emile at fenx.com
Sat May 27 11:52:45 EDT 2000
Hi all,
I have a situation where I want class instances to always
compare unequal. I thought I could do it with __cmp__,
but it appears that it sometimes is short circuited. Is
there a way around this?
Python 1.6a2 (#0, Apr 6 2000, 11:45:12) [MSC 32 bit (Intel)] on win32
>>> class Test:
def __cmp__(self, other):
print "__cmp__"
return -1
>>> a = Test()
>>> b = Test()
>>> a == b
__cmp__
0
>>> a = b
>>> a == b
1
TIA,
Emile van Sebille
emile at fenx.com
-------------------
More information about the Python-list
mailing list