(self, element)
Find the index of a child by identity, not value. Avoids issues with
        tag.contents.index(element) getting the index of equal elements.
Find the index of a child by identity, not value. Avoids issues with
        tag.contents.index(element) getting the index of equal elements.
Find the index of a child by identity not value . Avoids issues with tag . contents . index ( element ) getting the index of equal elements .
def index(self, element):
        """
        Find the index of a child by identity, not value. Avoids issues with
        tag.contents.index(element) getting the index of equal elements.
        """
        for i, child in enumerate(self.contents):
            if child is element:
                return i
        raise ValueError("Tag.index: element not in tag")
def index ( self , element ) : for i , child in enumerate ( self . contents ) : if child is element : return i raise ValueError ( "Tag.index: element not in tag" )