ZIP files

Michael Foord fuzzyman at gmail.com
Fri Nov 12 04:20:19 EST 2004


Mike Meyer <mwm at mired.org> wrote in message news:<x73bzhpfpx.fsf at guru.mired.org>...
> Ivo Woltring <Python at IvoNet.nl> writes:
> 
> > On 10 Nov 2004 08:05:28 -0800, oriana.falco at thalesesec.com (Oriana)
> > You might wish to try using a larger buffer than 8192 bytes.  BTW,
> > note that Python automatically closes the files since the file objects
> > are released when the function returns.
> 
> This behavior of file objects isn't guaranteed and doesn't happen in
> Jython. It's better - and more pythonic - to explicitly close files.
> 
> After all, explicit is better than implicit.
> 
>       <mike

Hmmm... does this mean that 

open(filename, 'w').write(filedata)

is unsafe ? It's so much more convenient when the object is only going
to be used for the single action.

Regards,

Fuzzy
http://www.voidspace.org.uk/atlantibots/pythonutils.html



More information about the Python-list mailing list