[issue1633648] incomplete numerical comparisons

Mark Dickinson report at bugs.python.org
Wed Feb 11 16:04:18 CET 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

This issue is out of date from the perspective of python-pgsql, since
that's long been fixed.

It's difficult to figure out exactly what the issue is here.  As best as
I can guess, it's something like the following.  After:

class MyInt(object):
    def __init__(self, n):
        self.n = n

    def __coerce__(self, other):
        if type(other) is float:
            return float(self.n), other

x = MyInt(3)

the comparison "x < 4.0" gives False in the 2.4+, and True in 2.3.

I'm closing this as a won't fix:  it doesn't seem worth changing the
comparison behaviour for Python 2.7 (which may well be the last in the
line of 2.x releases anyway), and the whole
coercion/three-way-comparison mess is gone in 3.x.

----------
resolution:  -> wont fix
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1633648>
_______________________________________


More information about the Python-bugs-list mailing list