[issue43602] Include Decimal's in numbers.Real

Mark Dickinson report at bugs.python.org
Tue Mar 23 06:21:49 EDT 2021


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

> I assume, the reason is: there is no lossless conversion to float's (and vice verse).

No, I don't think that's the reason (and in fact we _do_ have lossless conversion of floats to Decimal instances). IMO, the reasons are:

- it's not obvious what the *type* of the result of some_float + some_other_decimal should be, and

- it seems rather likely that any attempt to combine a float and a Decimal instance in this way is a bug, or at least something that hasn't been fully thought through by the developer, so we force the developer to make an explicit conversion

For historical discussions, see #1682.

----------
nosy: +mark.dickinson

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


More information about the Python-bugs-list mailing list