[Python-Dev] decimal API
Aahz
aahz at pythoncraft.com
Sat Jul 3 00:59:01 CEST 2004
On Fri, Jul 02, 2004, Raymond Hettinger wrote:
>
> So, my question for the group is whether to:
>
> * leave it as-is
> * raise a ValueError just like float('abc') or int('abc')
> * raise an Invalid Operation and return a quiet NaN.
>
> Either of the last two involves editing the third-party test cases which
> I am loathe to do. The second is the most Pythonic but does not match
> Mike's clarification. The third keeps within context of the spec but
> doesn't bode well for Decimal interacting well with the rest of python.
> The latter issue is unavoidable to some degree because no other python
> numeric type has context sensitive operations, settable traps, and
> result flags.
There's another option: allow both options one and two, with option two
the default; the test cases can manually set option one, while adding a
few extra ones to cover the default usage.
> A separate question is determining the default precision. Currently, it
> is set at 9 which conveniently matches the test cases, the docstring
> examples, and examples in the spec. It is also friendly to running
> time.
When this was discussed earlier (may have been in private), it was
decided to leave this because it's so easy to change.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"Typing is cheap. Thinking is expensive." --Roy Smith, c.l.py
More information about the Python-Dev
mailing list