"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > > lines = file("myfile","r").readlines() > > > > have any better guarantee of being closed automatically? > > Yes. The file object only lives on the evaluation stack, > and that is discarded in any case when the function terminates > (whether through a return or through an exception). In > addition, the object is released as soon as readlines > returns.
It's released even if the exception is raised inside readlines? -- http://mail.python.org/mailman/listinfo/python-list