This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gwideman
Recipients docs@python, gwideman
Date 2011-03-07.06:19:31
SpamBayes Score 6.5114416e-09
Marked as misclassified No
Message-id <1299478772.2.0.158667289214.issue11426@psf.upfronthosting.co.za>
In-reply-to
Content
On the csv doc page  (.../library/csv.html) most of the examples show creation of an anonymous file object within the csv.reader or csv.writer function, for example...

spamWriter = csv.writer(open('eggs.csv', 'w'), delimiter=' ',....

This anonymity prevents later closing the file, which seems especially problematic for a writer.  It also confuses users as to whether there's some sort of close function on a csv.reader or csv.writer object which should be called, or perhaps some other magic behind the scenes.

I'm pretty sure that it's the doc that is incorrect here.  

This issue was raised pernthetically here http://bugs.python.org/issue7198#msg124678 by sjmachin, though mysteriously overlooked in his later suggested patch http://bugs.python.org/issue7198#msg126593

I suggest changing all examples to include the complete cycle of opening an explicit file, and later closing it.
History
Date User Action Args
2011-03-07 06:19:32gwidemansetrecipients: + gwideman, docs@python
2011-03-07 06:19:32gwidemansetmessageid: <1299478772.2.0.158667289214.issue11426@psf.upfronthosting.co.za>
2011-03-07 06:19:31gwidemanlinkissue11426 messages
2011-03-07 06:19:31gwidemancreate