AST structures and memory leaks
robin at jessikat.demon.co.uk
Thu Mar 16 15:45:28 CET 2000
In message <1258906958-9249420 at hypernet.com>, Gordon McMillan
<gmcm at hypernet.com> writes
>Robin Becker wrote:
>> Is there any way to find the 'owner' of an instance?
>The general case would probably be:
> def __init__(self, owner, kids=None):
> self.owner = owner
> self.kids = kids
> if kids is None:
> self.kids = 
> def add(self, kid):
> def cleanup(self):
> for kid in self.kids:
> self.owner = None
>...which obviously requires an explicit call to root.cleanup()
>when you're done.
I already had the obvious programmer failing solution :( I was hoping
for some super meta programming solution which avoids the cycle somehow.
Andy doesn't want to use acquisition which would probably solve the
problem in a pinch.
More information about the Python-list