[issue4796] Decimal to receive from_float method
Steven D'Aprano
report at bugs.python.org
Fri Jan 2 14:18:09 CET 2009
Steven D'Aprano <steve at pearwood.info> added the comment:
Raymond:
> Accordingly, I recommend Decimal.from_float(f) with no
> qualifiers or optional arguments.
-0 on this one. It's going to confuse an awful lot of newbies when
they write Decimal.from_float(1.1) and get
Decimal('110000000000000008881784197001252...e-51').
Also, why not just extend the Decimal() constructor to accept a float
as the argument? Why have a separate from_float() method at all?
> To support the use case of wanting to round the input, I
> suggest a separate method modeled on Context.create_decimal().
+1 on this.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4796>
_______________________________________
More information about the Python-bugs-list
mailing list