File not closed on exception

Mel mwilson at the-wire.com
Tue Oct 20 09:41:38 EDT 2009


arve.knudsen at gmail.com wrote:

> I agree, but like I said, I've been told that this (implicit closing
> of files) is the correct style by more merited Python developers, so
> that made me think I was probably wrong ..

It would be nice.  The trouble is that CPython is not the only Python.  
Jython, for example, uses the Java Runtime Environment for its virtual 
machine.  JRE doesn't have reference-counts, so Jython can't close files 
immediately after the last reference ends.  It seems guaranteed object 
cleanup would lock Python out of too many possible platforms.

	Mel.





More information about the Python-list mailing list