[Python-Dev] Re: Object finalization for local (ie function)scopes
"Martin v. Löwis"
martin at v.loewis.de
Sun Jun 13 04:02:13 EDT 2004
Oliver Schoenborn wrote:
> Those objects that have "registered" themselves to the "cleaner" require
> finally-ization. Hence, if no objects registered themselves, there is only
> the overhead of an empty finally. The implementation details can worry about
> how registration takes place, and who does the cleanup. In scope.py,
> "registration" is handled by derivation from class NeedsFinalization --
> which I can eventually rename so please let's not get stuck on terminology
> at this stage. The cleaner is a function called ScopeGuardian.
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?
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?
If only some objects: which ones?
Regards,
Martin
More information about the Python-Dev
mailing list