Context manager for files vs garbage collection

Benjamin musiccomposition at
Tue Jun 17 04:59:27 CEST 2008

On Jun 16, 8:24 am, Bruno Desthuilliers <bruno.
42.desthuilli... at websiteburo.invalid> wrote:
> IIRC (please someone correct me if I'm wrong), proper release of file
> resources as soon as the file object gets out of scope is not garanteed
> in the language spec and is implementation dependant.

Right. Resources are freed in CPython right after they drop out of
scope. This is not true in other implementations, so it's best to be

More information about the Python-list mailing list