Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:
The problem with the roundtrip PyFloat_FromDouble(PyFloat_AsDouble(obj)) is that (in contrary to PyNumber_Index()) it is lossy. Converting Decimal, Fraction, float128 to float before using it in expression can lead to loss of precision. So such conversion looks to me less useful than operator.index(). ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40801> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com