[Python-Dev] [Python-3000] Rounding Decimals

Jim Jewett jimjjewett at gmail.com
Mon Jan 14 14:48:06 CET 2008


On 1/12/08, Guido van Rossum <guido at python.org> wrote:
> On Jan 12, 2008 5:09 PM, Jeffrey Yasskin <jyasskin at gmail.com> wrote:
> > During the discussion about the new Rational implementation
> > (http://bugs.python.org/issue1682), Guido and Raymond decided that
> > Decimal should not implement the new Real ABC from PEP 3141. So I've
> > closed http://bugs.python.org/issue1623 and won't be pursuing any of
> > the extra rounding methods mentioned on this thread.

> Well, I didn't really decide anything. I suggested that if the
> developers of Decimal preferred it, it might be better if Decimal did
> not implement the Real ABC, and Raymond said he indeed preferred it.

I read his objections slightly differently.

He is very clear that Decimal itself should be restricted to the
standard, and therefore should not natively implement the extensions.
But he also said that it might be reasonable for another package to
subset or superset it in a friendlier way.

numbers.py is a different module, which must be explicitly imported.

If the objection is that

    >>> decimal.Decimal("43.2").imag

would work (instead of throwing an exception) only when numbers.py has
already been imported, then ... well, that confusion is inherent in
the abstract classes.

Or is the problem that it *still* wouldn't work, without help from the
decimal module itself?  In that case, 3rd party registration is fairly
limited, and this might be a good candidate for trying to figure out
ABCs and adapters *should* work together.

-jJ


More information about the Python-Dev mailing list