[Python-ideas] isinstance(Decimal(), Real) -> False?

Mark Dickinson dickinsm at gmail.com
Fri Aug 30 17:03:29 CEST 2013


On Thu, Aug 29, 2013 at 3:02 AM, Steven D'Aprano <steve at pearwood.info>wrote:

> On 28/08/13 20:48, Draic Kin wrote:
>
>> For the same reason, I could think that isinstance(Decimal, Rational) ->
>> True
>>
>
> If Decimal were a subclass of Rational, so should float. The only
> fundamental difference between the two is that one uses base 10 floating
> point numbers and the other uses base 2.


Exactly, yes!  The "Decimal is a fixed-point type" and "Decimal is exact"
myths seem to be unfortunately common.

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130830/30dc35a5/attachment.html>


More information about the Python-ideas mailing list