def addChild2(self, child):
        """ Add the child object 'child'. If it is already present,
        it is overwritten by default """
        
        currChild = self.getChild(child.getName())
        if currChild:
            index = self.getIndex(currChild)
            if index != -1:
                self._children[index] = child
                child.setParent(self)
                # Unset the existing child's parent
                currChild.setParent(None)
                del currChild
                
                self.__setChildDict(child)
        else:
            child.setParent(self)            
            self._children.append(child)
            self.__setChildDict(child)
 Add the child object 'child'. If it is already present,
        it is overwritten by default 
recipes/Python/498249_Composite_designpattern_using/recipe-498249.py