[Python-Dev] Decimal data type issues

Greg Ewing greg at cosc.canterbury.ac.nz
Thu Apr 15 20:09:38 EDT 2004


Ka-Ping Yee <python-dev at zesty.ca>:

> The extra method should be specifically for the exceptional case,
> and named appropriately.
> 
>     Decimal.exact_float(value)

That's a confusing name, since it seems to be promising that the
conversion will be exact. While this might technically be true for
certain values of float, there's no way the implementation can know
whether the result is exactly what the user had in mind for the
meaning of that float.

I think the name from_float is fine, since it says "I know
constructing a Decimal from a float isn't necessarily exact, but I
want to do it anyway, and I'm prepared to accept the result,
whatever it is."

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+



More information about the Python-Dev mailing list