Dan <[EMAIL PROTECTED]> writes: > Is this discouraged?: > > for line in open(filename): > <do something with line>
Yes.
> Can I count on the ref count going to zero to close the file?
You really shouldn't. It's a CPython artifact.
> I understand that the upcoming 'with' statement will obviate this
> question, but how about without 'with'?
f = open(filename)
try:
for line in f:
<do something with line>
finally:
f.close()
--
http://mail.python.org/mailman/listinfo/python-list
