[issue7010] Rounding when converting float tuple to str

Mark Dickinson report at bugs.python.org
Mon Sep 28 11:12:40 CEST 2009


Mark Dickinson <dickinsm at gmail.com> added the comment:

This is expected (and correct) behaviour for Python 2.x and 3.0.  Note
that the first example calls .1.__str__, while the second calls .1.__repr__.

Python 2.6.2 (r262:71600, Aug 26 2009, 09:40:44)
[GCC 4.2.1 (SUSE Linux)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> str(.1)
'0.1'
>>> repr(.1)
'0.10000000000000001'
>>> str((.1,))
'(0.10000000000000001,)'
>>> tuple(str(x) for x in (.1,))
('0.1',)

----------
status: pending -> open

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7010>
_______________________________________


More information about the Python-bugs-list mailing list