Iterators

Leo defines Python iterators that return positions. These iterators are the easiest way of gaining access to the nodes of Leo outlines. Here are just a few examples:

  • c.all_positions() returns all the positions of the outline in order.

    Note: Cloned nodes will appear several times in this list.

  • c.all_unique_nodes() returns all the vnodes of the outline.

  • p.self_and_subtree() returns p and all its descendants.

  • p.children() returns all of p’s direct children.