[Python-Dev] Adventures with Decimal

Facundo Batista facundobatista at gmail.com
Sat May 21 02:53:33 CEST 2005


On 5/20/05, Guido van Rossum <gvanrossum at gmail.com> wrote:

> > Python's Decimal constructor accepts a context argument, but the only
> > use made of it is to possibly signal a ConversionSyntax condition.
> 
> You know that, but Raymond seems confused.  From one of his posts (point (k)):
> 
> "Throughout the implementation, the code calls the Decimal
> constructor to create intermediate values.  Every one of those calls
> would need to be changed to specify a context."

The point here, I think, is that intermediate Decimal objects are
created, and the whole module assumes that the context does not affect
that intermediate values. If you change this and start using the
context at Decimal creation time, you'll have to be aware of that in a
lot of parts of the code.

OTOH, you can change that and run the test cases, and see how bad it
explodes (or not, ;).

.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-Dev mailing list