[New-bugs-announce] [issue4796] Decimal to receive from_float method
report at bugs.python.org
Wed Dec 31 23:59:19 CET 2008
New submission from Steven D'Aprano <steve at pearwood.info>:
In the PEP for Decimal, it was discussed that the class should have a
from_float() method for converting from floats, but to leave it out of
the Python 2.4 version:
Following discussions with Mark Dickinson, I would like to request
that this now be implemented.
The suggested API is:
At the risk of derailing the request, I wonder whether it is better to
give a context rather than a number of decimal places?
Pro: better control over conversion, as you can specify rounding
method as well as number of decimal places.
Con: more difficult for newbies to understand.
Semi-pro: float to decimal conversions are inherently tricky, perhaps
we should be discouraging newbies from blindly calling from_float()
and make the (hypothetical) context argument mandatory rather than
components: Library (Lib)
title: Decimal to receive from_float method
type: feature request
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce