Context manager for files vs garbage collection

Benjamin musiccomposition at gmail.com
Mon Jun 16 22:59:27 EDT 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
explicit.



More information about the Python-list mailing list