(self, index)
Locates an element given the index among siblings with the same tag.
Locates an element given the index among siblings with the same tag.
Locates an element given the index among siblings with the same tag .
def _find_index(self, index):
    """Locates an element given the index among siblings with the same tag."""
    if isinstance(index, str) and self._spec.identifier:
      for i, element in enumerate(self._elements):
        if (element.tag == self._spec.name
            and getattr(element, self._spec.identifier) == index):
          return i
      raise self._identifier_not_found_error(index)
    else:
      count = 0
      for i, element in enumerate(self._elements):
        if element.tag == self._spec.name:
          if index == count:
            return i
          else:
            count += 1
      raise IndexError('list index out of range')
def _find_index ( self , index ) : if isinstance ( index , str ) and self . _spec . identifier : for i , element in enumerate ( self . _elements ) : if ( element . tag == self . _spec . name and getattr ( element , self . _spec . identifier ) == index ) : return i raise self . _identifier_not_found_error ( index ) else : count = 0 for i , element in enumerate ( self . _elements ) : if element . tag == self . _spec . name : if index == count : return i else : count += 1 raise IndexError ( 'list index out of range' )