(self)
return self
Destructively rips this element out of the tree.
Destructively rips this element out of the tree.
Destructively rips this element out of the tree .
def extract(self):
        """Destructively rips this element out of the tree."""
        if self.parent is not None:
            del self.parent.contents[self.parent.index(self)]

        #Find the two elements that would be next to each other if
        #this element (and any children) hadn't been parsed. Connect
        #the two.
        last_child = self._last_descendant()
        next_element = last_child.next_element

        if self.previous_element is not None:
            self.previous_element.next_element = next_element
        if next_element is not None:
            next_element.previous_element = self.previous_element
        self.previous_element = None
        last_child.next_element = None

        self.parent = None
        if self.previous_sibling is not None:
            self.previous_sibling.next_sibling = self.next_sibling
        if self.next_sibling is not None:
            self.next_sibling.previous_sibling = self.previous_sibling
        self.previous_sibling = self.next_sibling = None
        return self
def extract ( self ) : if self . parent is not None : del self . parent . contents [ self . parent . index ( self ) ] #Find the two elements that would be next to each other if #this element (and any children) hadn't been parsed. Connect #the two. last_child = self . _last_descendant ( ) next_element = last_child . next_element if self . previous_element is not None : self . previous_element . next_element = next_element if next_element is not None : next_element . previous_element = self . previous_element self . previous_element = None last_child . next_element = None self . parent = None if self . previous_sibling is not None : self . previous_sibling . next_sibling = self . next_sibling if self . next_sibling is not None : self . next_sibling . previous_sibling = self . previous_sibling self . previous_sibling = self . next_sibling = None return self