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

Mark Dickinson dickinsm at gmail.com
Fri Aug 30 16:54:21 CEST 2013


On Wed, Aug 28, 2013 at 8:02 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:

> > The Decimal Type
> >
> > After consultation with its authors it has been decided that the
> > Decimal type should not at this time be made part of the numeric
> > tower.
> > """
> >
> > What was the rationale for this decision and does it still apply?
>
> If I recall correctly, it was the fact that isinstance(d, Real)
> implies isinstance(d, Complex), yet there's no way to do complex
> arithmetic with Decimal real and imaginary components.
>

In the past, there's also been a general desire to keep the decimal module
API closely focused on the specification, and to avoid adding too much
functionality outside the spec;  I suspect that that was the main
motivation.  I don't recall Complex entering the discussion, but it might
well have done.

It may be time to revisit the discussion.  I'd like to see the Decimal type
being more closely integrated with the rest of the language in the future
(and adding the C version of Decimal was the first step along that path).

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


More information about the Python-ideas mailing list