[Kinda stealing the thread]

On Tue, Jan 09, 2007 at 09:05:30PM -0300, Gabriel Genellina wrote:
> And do you actually need so many open files simultaneously?
> Try to close them explicitely when you finish working on them - do 
> not rely on GC for closing files. This has *always* been the 
> recomended practice (except maybe, inside a short script that 
> finishes quickly).

If I use a file() in a for, how to I explicitely close the file?

<code>
for line in file('contents'):
   print line
</code>

Would this work like the new 'with' statement or it will only be closed
when the GC finds it?

--
Julio "slow" Biason <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to