Erik Max Francis
max at alcyone.com
Mon Jul 28 01:31:19 CEST 2003
Dennis Lee Bieber wrote:
> Hallvard B Furuseth fed this fish to the penguins on Friday 25 July
> 2003 12:51 pm:
> > Um. Explicit close does raise an exception if it fails, right?
> Looks like it doesn't care... As long as the file /had/ been
> first (doesn't look like the interactive interpreter collected f until
> the del either).
I don't think you've demonstrated that; all you've shown is that builtin
Python file objects make file closing idempotent. You haven't
demonstrated a case where there actually is an I/O error that occurs
when .close gets called. In particular, I _really_ don't know what you
meant to show with this snippet, as it really has nothing to do with
files at all:
> >>> f
> <closed file 't.t', mode 'w' at 0x809dc88>
> >>> del f
> >>> f.close()
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> NameError: name 'f' is not defined
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ He who knows how to be poor knows everything.
\__/ Jules Michelet
More information about the Python-list