[Python-Dev] PEP 327: from_float()

Tim Peters tim.peters at gmail.com
Fri Jul 2 17:03:31 CEST 2004


[A.M. Kuchling]
> ePEP 327 says "it was decided to omit from_float() from the API for
> Py2.4".  Does this imply that from_float might be in some future
> version?

I don't think it *implies* it, but it might happen anyway.

There eventually needs to be a way to combine Decimal with native
binary fp, and to work naturally with Decimal in many other parts of
Python too.  But the immediate need for Decimal is in apps that can't
tolerate the representation errors in converting between base 10 and
base 2 floats, and I expect it's actually an aid to such apps if
there's no builtin way to confuse binary floats with Decimals at the
start.

This is meant not to make the same mistake we made with Unicode
<wink>:  the idea that 8-bit strings can be mixed with Unicode
strings, except sometimes you get mysterious data-dependent
exceptions, has probably caused more overall pain than if we had
forced a clean separation there at the start.



More information about the Python-Dev mailing list