archimedes.tree.leavesΒΆ
- archimedes.tree.leaves(tree: Tree, is_leaf: Callable[[Any], bool] | None = None) list[ArrayLike]ΒΆ
Extract all leaf values from a tree.
- Parameters:
tree (Tree) β A tree from which to extract leaves.
is_leaf (callable, optional) β A function that takes a tree node as input and returns a boolean indicating whether it should be considered a leaf.
- Returns:
leaves β A list of all leaf values from the tree.
- Return type:
list
See also
tree_flattenFlatten a tree into a list of leaves and a treedef
tree_mapApply a function to each leaf in a tree