Commits

Luke Plant  committed 221b397

Algorithm cleanup

  • Participants
  • Parent commits a6ff00a

Comments (0)

Files changed (1)

File bibleverses/read.py

         if self.nodes:
             return self.nodes[0]
 
-        # If at the root, stop here
-        if limit_to_root is self:
-            return None
-        # Silbings
-        next_sibling = self.next_sibling()
-        if next_sibling is not None:
-            return next_sibling
-        # Parents
-        p = self.parent
+        # Siblings and ancestor siblings
+        p = self
         while p is not None and p is not limit_to_root:
             p_sibling = p.next_sibling()
             if p_sibling is not None: