nodify.traverse_tree_backward

nodify.traverse_tree_backward(leaves: Sequence[Node], func: Callable[[Node], Any]) None[source]

Traverse a tree of nodes in a backwards fashion.

Parameters:
  • leaves (Sequence[Node]) – The leaves of the tree to traverse.

  • func (Callable[[Node], Any]) – The function to apply to each node in the tree. Note that you can raise a StopTraverse exception to stop the traversal of the tree for any reason.