On 2005-02-08, Marc Huffnagle <[EMAIL PROTECTED]> wrote:
>>>for line in file(...):
>>> # do stuff
> When you read a file with that method, is there an implied close() call
> on the file? I assume there is, but how is that handled?
The file will be closed when the the file object is deleted by
the garbage collection algorithm. That will happen sometime
after the for loop exits and before the program exits. In
normal C-Python I believe it happens immediately after the for
loop exits. However, that behavior is not guaranteed by the
language spec.
--
Grant Edwards grante Yow! Now that I have my
at "APPLE", I comprehend COST
visi.com ACCOUNTING!!
--
http://mail.python.org/mailman/listinfo/python-list