[Python-Dev] Adventures with Decimal
Raymond Hettinger
python at rcn.com
Sat May 21 03:51:55 CEST 2005
[Michael Chermside]
> Frankly, I have no idea WHAT purpose is served by passing a context
> to the decimal constructor... I didn't even realize it was allowed!
Quoth the docs for the Decimal constructor:
"""
The context precision does not affect how many digits are stored. That
is determined exclusively by the number of digits in value. For example,
"Decimal("3.00000")" records all five zeroes even if the context
precision is only three.
The purpose of the context argument is determining what to do if value
is a malformed string. If the context traps InvalidOperation, an
exception is raised; otherwise, the constructor returns a new Decimal
with the value of NaN.
"""
Raymond
More information about the Python-Dev
mailing list