[issue35707] time.sleep() should support objects with __float__

Serhiy Storchaka report at bugs.python.org
Sun Jan 13 03:52:30 EST 2019


Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:

This can cause a loss of precision for Decimal.

If we want to support other numerical types with loss in double rounding, the most reliable way is to represent them as fractions (x.as_integer_ratio() or (x.numerator, x.denominator)) and use precise integer arithmetic.

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35707>
_______________________________________


More information about the Python-bugs-list mailing list