[Python-Dev] __del__ and tp_dealloc in the IO lib
Antoine Pitrou
solipsis at pitrou.net
Fri Jan 23 16:58:03 CET 2009
Guido van Rossum <guido <at> python.org> writes:
>
> And, by the way, "for line in open(filename): ..." will continue to
> work. It may just not close the file right away. This is a forgivable
> sin in a small program that opens a few files only. It only becomes a
> program when this is itself inside a loop that loops over many
> filenames -- you could run out of file descriptors.
It can also be a problem under Windows where, IIRC, you can't delete a file
which is still opened somewhere (even for reading).
More information about the Python-Dev
mailing list