Scanning a file

Fredrik Lundh fredrik at pythonware.com
Tue Nov 1 15:36:36 CET 2005


Alex Martelli wrote:

>> As far as I know, Python simply relies on the opreating system to close
>> files left open at the end of the program.
>
> Nope, see
> <http://cvs.sourceforge.net/viewcvs.py/python/python/dist/src/Objects/fi
> leobject.c?rev=2.164.2.3&view=markup>

that's slightly misleading: CPython will make a decent attempt (via the module cleanup
mechanism: http://www.python.org/doc/essays/cleanup.html ), but any files that are not
closed by that process will be handled by the OS.

CPython is not designed to run on an OS that doesn't reclaim memory and other re-
sources upon program exit.

</F> 






More information about the Python-list mailing list