siblings

returns the sibling of this element.

Source


def siblings(self):
    ret = pyNodeList()
    if self.has_parent():
        children = self._parent.children()
        if isinstance(children, pyNodeList) and len(children) != 0:
            for ch in children:
                if self != ch:
                    ret.append(ch)
        elif isinstance(children, pyNodeList):
            ret.append(children)
    if len(ret) == 1: return ret[0]
    else: return ret