[EMAIL PROTECTED] wrote: > Hello, > > > I got a problem deleting objects, which are placed in a hirarchy.... > > Asume we have the following code: > ######################################################## > class parent: > > MyChilds = [] # this list is filled with childs.... > > def AddChild(self, child): > # add childs here, however this is done, it's not the point... > child.MyParent = self > > def RemoveChild(self, child): > # delete child from the list.... the way this is done is not > our > # problem here > > > class child: > > MyParent = 0 > > def deleteMe(self): > MyParent.RemoveChild(self) > ##############################################################
Please help me understand the child class. It does not make much sense to me at all. Why is it not sufficient to call child.parent.remove(child) if the caller holds a child object but not the parent? Otherwise it should be sufficient to call parent.remove(child). Kay -- http://mail.python.org/mailman/listinfo/python-list