[issue18842] Add float.is_finite is_nan is_infinite to match Decimal methods

Christian Heimes report at bugs.python.org
Sun Oct 13 15:56:48 CEST 2013


Christian Heimes added the comment:

Pardon?

The methods could be added to complex, too. cmath implements the methods as:

is_finite:
    Py_IS_FINITE(z.real) && Py_IS_FINITE(z.imag)
is_infinite:
    Py_IS_INFINITY(z.real) || Py_IS_INFINITY(z.imag)
is_nan:
    Py_IS_NAN(z.real) || Py_IS_NAN(z.imag)

For numbers.Real: We can't make the methods abstractmethods because it would be an incompatible change.

----------

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


More information about the Python-bugs-list mailing list