catching a del
Tino Wildenhain
tino at wildenhain.de
Fri Mar 2 04:34:51 EST 2001
Hi Dan,
Dan Parisien wrote:
>
> class obj:
> def __init__(self, name, parent):
> parent.children[name] = self
> self.parent = parent
> self.name = name
>
> def onDelete(self): #?!
> del self.parent[self.name]
>
> I want to be able to catch a del of an instance of the above class so I can
> remove it from its parent dictionary. Is there a way? (note it cannot be in
> a destructor because there will always be a reference inside the parent
> dict)
perhaps its __del__() ?
Regards
Tino
More information about the Python-list
mailing list