[New-bugs-announce] [issue13573] csv.writer uses str() for floats instead of repr()
Raymond Hettinger
report at bugs.python.org
Sat Dec 10 19:49:55 CET 2011
New submission from Raymond Hettinger <raymond.hettinger at gmail.com>:
The csv.writer needs a special case for floats to print them to full precision. See http://stackoverflow.com/a/8455313/1001643
In Py2.7, the csv.writer converts floats to strings using str(). This will store 1323494016.8556759 as '1323494016.86' and unnecessarily throw away precision.
In Py3.2, this isn't a problem because float.__str__ now returns full precision, the same a float.__repr__.
----------
assignee: rhettinger
messages: 149179
nosy: rhettinger
priority: normal
severity: normal
status: open
title: csv.writer uses str() for floats instead of repr()
type: behavior
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13573>
_______________________________________
More information about the New-bugs-announce
mailing list