(self, successor)
Makes the given element the immediate successor of this one.

        The two elements will have the same parent, and the given element
        will be immediately after this one.
Makes the given element the immediate successor of this one.
Makes the given element the immediate successor of this one .
def insert_after(self, successor):
        """Makes the given element the immediate successor of this one.

        The two elements will have the same parent, and the given element
        will be immediately after this one.
        """
        if self is successor:
            raise ValueError("Can't insert an element after itself.")
        parent = self.parent
        if parent is None:
            raise ValueError(
                "Element has no parent, so 'after' has no meaning.")
        # Extract first so that the index won't be screwed up if they
        # are siblings.
        if isinstance(successor, PageElement):
            successor.extract()
        index = parent.index(self)
        parent.insert(index+1, successor)
def insert_after ( self , successor ) : if self is successor : raise ValueError ( "Can't insert an element after itself." ) parent = self . parent if parent is None : raise ValueError ( "Element has no parent, so 'after' has no meaning." ) # Extract first so that the index won't be screwed up if they # are siblings. if isinstance ( successor , PageElement ) : successor . extract ( ) index = parent . index ( self ) parent . insert ( index + 1 , successor )