Q on explicitly calling file.close
Jan Kaliszewski
zuo at chopin.edu.pl
Sun Sep 6 14:14:02 EDT 2009
05-09-2009 r <rt8396 at gmail.com> wrote:
> i find the with statement (while quite useful in general
> practice) is not a "cure all" for situations that need and exception
> caught.
In what sense?
I think that:
with open(...) as f:
foo...
is equivalent to:
f = open(...)
try:
foo...
finally:
f.close()
Obviously it doesn't substitute catching with 'except', but I don't
see how it could disturb that.
Cheers,
*j
--
Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>
More information about the Python-list
mailing list