[docs] Examples in "13.1. csv — CSV File Reading and Writing" don't close files

Neil Vass neil.vass at gmail.com
Tue Feb 8 12:01:13 CET 2011


Hi,

I have a suggestion for the csv module's documentation. The examples in
http://docs.python.org/library/csv.html show file reading like this:

reader = csv.reader(open("some.csv", "rb"))

This leaves the file handle open after use, without a way to close it. A
better example might be

ifile = open("some.csv", "rb")
reader = csv.reader(ifile)
* ... process file ...*
ifile.close()


Thanks for all your good work,
Neil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20110208/c8edd034/attachment.html>


More information about the docs mailing list