File not closed on exception

arve.knudsen at gmail.com arve.knudsen at gmail.com
Tue Oct 20 14:31:21 EDT 2009


On 20 Okt, 16:00, Bruno Desthuilliers <bruno.
42.desthuilli... at websiteburo.invalid> wrote:
> What's your problem with the with ???

No problem whatsoever, but I believe I wrote this utility function
before the keyword was available, and it might be good to support
older Python versions.

> But anyway : explicitely releasing resources such as files, network
> connections etc is of course the RightThing(tm), except eventually in
> one-shot throwaway scripts.
>
> > However, when providing a patch for a
> > high-profile opensource Python project I was scolded for going to such
> > lengths, as the prescribed style was to just open files and let them
> > be closed implicitly.
>
> Err... Care to name the project ? I hope it's not one I ever advertized :(

I'm not going to name the project, but it is incidentally used by the
Python project itself :)

Arve



More information about the Python-list mailing list