[issue10954] No warning for csv.writer API change
report at bugs.python.org
Sun Jan 23 06:46:52 CET 2011
John Machin <sjmachin at lexicon.net> added the comment:
I don't understand "Changing csv api is a feature request that could only happen in 3.3". This is NOT a request for an API change. Lennert's point is that an API change was made in 3.0 as compared with 2.6 but there is no fixer in 2to3. What is requested is for csv.reader/writer to give more meaningful error messages for valid 2.x code that has been put through fixer-less 2to3.
The name of the arg is "newline". "newlines" is an attribute that stores what was actually found in "universal newlines" mode.
newline='' is needed on input for the same reason that binary mode is required in 2.x: \r and \n may quite validly appear in data, inside a quoted field, and must not be treated as part of a row separator.
newline='' is needed on output for the same reason that binary mode is required in 2.x: any \n in the data and any \n in the caller's chosen "line" terminator must be preserved from being changed to os.linesep (e.g. \r\n).
"newline" is not available as an attribute of the _io.TextIOWrapper object created by open('xxx.csv', 'w', newline=''); is exposing this possible?
versions: +Python 3.2 -Python 3.3
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list