to ask an container instance to suicide
jm.suresh at gmail.com
Mon Nov 20 10:42:22 CET 2006
I have containers to hold geometrical objects. The members in these
containers can again be containers them self. Now, In the program I
would be moving objects from one container to another. In this process,
If the number of members in one of the containers becomes just one, I
want to delete that container and have only its only member in place of
it in the parent container.
I have implemented setting and getting the container members using
Right now, I am planning to do this this way:
Maintain a reference to parent container in each container.
When the condition is detected, do self.parent.deleteObject(self) .
index = self._members.index(memberId)
self._members[index] = memberId._members
Will this work. Or is there any other simple way to do this?
More information about the Python-list