[issue8748] integer-to-complex comparisons give incorrect results
Meador Inge
report at bugs.python.org
Fri May 21 06:26:41 CEST 2010
Meador Inge <meadori at gmail.com> added the comment:
2.7 patch attached. The implementation is mostly the same as the 3.2 one, but there is one quirk. Namely, 2.7 (and other 2.x's) has the following odd behavior:
>>> 1j < None
False
>>> 1j < 1
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: no ordering relation is defined for complex numbers
To perserve this behavior I had to do the type checks for 'int', 'long', 'complex', and 'float' at the beginning. I tried 'PyNumber_Check' first, but it returns 1 for old-style classes since the number protocol is filled in for the 'instance' type.
----------
Added file: http://bugs.python.org/file17425/issue-8748.py27.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8748>
_______________________________________
More information about the Python-bugs-list
mailing list