Recursive __cmp__ in different Python versions
Roman Suzi
rnd at onego.ru
Mon Feb 14 13:25:53 EST 2005
#The following Python code:
class X:
def __cmp__(self, y):
print "cmp", self, y
return cmp(self, y)
x = X()
print x < 10
# gives interesting results under different Python version.
The most common sense in the result in Python 2.4: recursion
limit reached.
Python 2.3 tries 20+ times and then give up.
Python1.5 gives segmentation fault...
Sincerely yours, Roman Suzi
--
rnd at onego.ru =\= My AI powered by GNU/Linux RedHat 7.3
More information about the Python-list
mailing list