This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Sergey.Kirpichev
Recipients Sergey.Kirpichev, docs@python, rhettinger
Date 2021-03-23.08:21:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1616487716.28.0.177493646825.issue43602@roundup.psfhosted.org>
In-reply-to
Content
> Operations between decimals and floats raise a TypeError.

I saw this)  And as I said, I assume, the reason is: there is no lossless conversion to float's (and vice verse).

If so (point 2), neither multiple-precision type (e.g. gmpy2.mpfr) can subclass from the numbers.Real (there can be different precisions, different bases) and that sounds too restrictive.

From the mathematician point of view, both built-in float's and Decimal's could be viewed as (inexact!) representations for real numbers.  But if _any_ such representations, conforming the numbers abc must be lossless converted to each other - that might be a documentation issue.

> P.S.  With respect to #4, we've harmonized the APIs as much as we sensibly can.

That was very minor, yes.  Something like try-except could be used here, trying as_integer_ratio().
History
Date User Action Args
2021-03-23 08:21:56Sergey.Kirpichevsetrecipients: + Sergey.Kirpichev, rhettinger, docs@python
2021-03-23 08:21:56Sergey.Kirpichevsetmessageid: <1616487716.28.0.177493646825.issue43602@roundup.psfhosted.org>
2021-03-23 08:21:56Sergey.Kirpichevlinkissue43602 messages
2021-03-23 08:21:55Sergey.Kirpichevcreate