John Machin <sjmac...@users.sourceforge.net> added the comment:

Skip, I'm WRITING, not reading.. Please read the 3.1 documentation for 
csv.writer. It does NOT mention newline='', and neither does the example. 
Please fix.

Other problems with the examples: (1) They encourage a bad habit (open inside 
the call to reader/writer); good practice is to retain the reference to the 
file handle (preferably with a "with" statement) so that it can be closed 
properly. (2) delimiter=' ' is very unrealistic.

The documentation for both 2.x and 3.x should be much more explicit about what 
is needed in open() for csv to work properly and portably:

2.x read: use mode='rb' -- otherwise fail on Windows
2.x write: use mode='wb' -- otherwise fail on Windows
3.x read: use newline='' -- otherwise fail unconditionally(?)
3.x write: use newline='' -- otherwise fail on Windows

The 2.7 documentation says """If csvfile is a file object, it must be opened 
with the 'b' flag on platforms where that makes a difference""" ... in my 
experience, people are left asking "what platforms? what difference?"; Windows 
should be mentioned explicitly.

----------
versions: +Python 2.7, Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7198>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to