[pypy-dev] What's wrong with >>> open(?xxx?, ?w?).write(?stuff?) ?
Armin Rigo
arigo at tunes.org
Fri Aug 20 16:06:31 CEST 2010
Hi Donny,
On Fri, Aug 20, 2010 at 06:23:26AM -0400, Donny Viszneki wrote:
> Armin: Sakesun used "del f" and it appears you did not. In Python
> IIRC, an explicit call to del should kick off the finalizer to flush
> and close the file!
No, you are wrong. Try for example:
>>> f = open('xxx')
>>> g = f
>>> del f
After this, 'g' still refers to the file, and it is still open.
If you want the file to be flushed and closed, then call 'f.close()' :-)
A bientot,
Armin.
More information about the Pypy-dev
mailing list