[Python-3000] Reconsider repr(0.1) == '0.10000000000000001'
Guido van Rossum
guido at python.org
Mon Dec 10 20:20:45 CET 2007
On Dec 9, 2007 6:29 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>
> "Georg Brandl" <g.brandl at gmx.net> wrote in message
> news:fjgkvu$s7j$1 at ger.gmane.org...
> | Terry Reedy schrieb:
> | > It seems your real problem is that repr() rather than str() is applied
> | > within collections. (I am not sure exactly why but suspect there is a
> | > reason.)
> |
> | Consider ["1, 2, 3"].
>
> OK, but this is only an issue with the difference between the str and repr
> of *strings*. The str function of collections *could* be modified to use
> str on numbers. The number of digits is irrelevance to the string
> formatting issue. The new Number ABC would make this switch easier, of
> course.
I don't think this line of argument is productive.
I am looking forward to fixes to repr() that maintain the
float->binary->float roundtripping property while also make repr(0.1)
== "0.1" and repr(0.3) == "0.3".
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list