In message <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] wrote:

> try:
>     for line in open(myFileName):
>         count += 1
> except IOError:
>     print "Can't open myfile"
> 
> (I know, this is bad, I never close the file, but its just for
> illustration).

No, that's fine. The file object returned by "open" is refcounted, so when
the last reference to it disappears, it is closed.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to