[Tutor] Need a better name for this function
Hugo
hugo.yoshi at gmail.com
Tue Dec 15 22:51:16 CET 2009
On 15-12-2009 22:46, Richard D. Moores wrote:
> def float_to_exact_number_stored_in_computer(f):
> """
> Given a float, return the exact number stored in computer.
>
> See
> http://docs.python.org/3.1/tutorial/floatingpoint.html#representation-error
> """
> from decimal import Decimal
> return Decimal.from_float(f)
>
> I've just borrowed from the doc, but that name is too long, isn't it?
> Please suggest something shorter but still meaningful.
>
> Thanks,
>
> Dick Moores
What's wrong with just using the Decimal.from_float function directly?
This wrapper doesn't really do anything, seems like having a separate
function would be unnecessary.
Hugo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20091215/a41922ff/attachment-0001.htm>
More information about the Tutor
mailing list