[Python-Dev] Re: Decimal data type issues

Batista, Facundo FBatista at uniFON.com.ar
Wed Apr 21 12:54:14 EDT 2004

[Jewett, Jim J]

#- This is effectively saying
#- (1)  Create a decimal using the default context.
#- (2)  Change the context to my custom context.
#- (3)  Perform various rounding and scaling operations.
#- (4)  Change the context back to the default.
#- vs
#- (1)  Create a decimal using my custom context.
#- The four-step procedure may (or may not) be done just as
#- efficiently under the covers, but it is ugly.
#- Is there any reason why input and output should be the only
#- operations that do not honor an optional local context?

I didn't reviewed all the mails to write down the community will, but as far
I recall, you *could* use context in creation time.

I think that still is not clear if to use...

  Decimal(number, [context])


  Decimal.using_context(number, [context])

...(I prefer the laters) but I think you could use it.

But: There is no such thing as "scale" in the context.

.	Facundo

More information about the Python-Dev mailing list