[Python-Dev] Re: Object finalization for local (ie function)scopes

Oliver Schoenborn oliver.schoenborn at utoronto.ca
Sun Jun 13 14:54:49 EDT 2004


From: "Martin v. Löwis" <martin at v.loewis.de>
> Oliver Schoenborn wrote:
> > Those objects that have "registered" themselves to the "cleaner" require
> > finally-ization.
>
> I'm still uncertain, though, as to what objects precisely should get
> the cleanup calls: *All* objects that have registered with the cleaner,
> or only some of them?

I don't see why it wouldn't be all objects. You'll have to show me an
example for when that might be the case. Each object that has registered is
saying, "I need cleanup at exit of scope, because I should be the only one
left". If you don't clean it up you are not upholding your side of the
contract.

> If all objects: what if nested function calls each have to-clean
> objects, and only the inner function returns? Why is it then useful
> to also clean objects that where created in an outer function?

You'll have to show me some code before I can answer this.

Thanks,
Oliver




More information about the Python-Dev mailing list