R. David Murray <[email protected]> added the comment: I don't think it would be beneficial to just talk about closing the file descriptor, or to talk about os open file limits. Closing open files when they are no longer needed is just good programming practice and IMO a discussion of it doesn't belong in the library docs unless it is at a more generic level (like os.open or open).
I don't think the code shown in your blog post is using the library the way it is designed. If the programmer wants an open file object, they should use TemporaryFile or NamedTemporaryFile. If there really is a reason to get an os file handle and turn it into a file object, then os.openfd should be used. Perhaps the appropriate change to the documentation would be to mention os.openfd, and to mention that os.close is the correct function to use to close the file handle when it is no longer needed (unless, of course, openfd has been called). As for your markup, your ``os.close`` should instead be :func:`os.close`, which results in the automatic creation of a link to the os.close documentation. ---------- nosy: +r.david.murray priority: -> normal versions: +Python 2.6, Python 2.7, Python 3.1 _______________________________________ Python tracker <[email protected]> <http://bugs.python.org/issue6875> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
