[docs] [issue10461] Use with statement throughout the docs

Éric Araujo report at bugs.python.org
Sat Nov 20 13:36:43 CET 2010


Éric Araujo <merwok at netwok.org> added the comment:

with also replaces open-try-do stuff-finally-close, the correct idiom for ensuring file handles are always closes in all VMs.

I don’t think the doc style guide is the right place, since this is a code issue.  with is advertised in http://docs.python.org/dev/tutorial/inputoutput#methods-of-file-objects and http://docs.python.org/dev/howto/doanddont#exceptions ; http://docs.python.org/dev/library/functions#open says nothing about closing, and http://docs.python.org/dev/library/io tells about the with statement without recommending it strongly.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10461>
_______________________________________


More information about the docs mailing list