imas.util.visit_children¶
-
imas.util.visit_children(func: Callable, node: IDSBase, *, leaf_only: bool =
True, visit_empty: bool =False, accept_lazy: bool =False) None¶ Apply a function to node and its children
IMAS-Python objects generally live in a tree structure. Similar to Pythons
map(), this method can be used to apply a function to objects within this tree structure.- Parameters:
- Keyword Arguments:
- leaf_only: bool =
True¶ Apply function to:
True: Only leaf nodes, not internal nodesFalse: All nodes, including internal nodes
- visit_empty: bool =
False¶ When set to True, also apply the function to empty nodes.
- accept_lazy: bool =
False¶ See documentation of
iter_nonempty_(). Only relevant whenvisit_emptyis False.
- leaf_only: bool =
Example
# Print all filled leaf nodes in a given IMAS-Python IDSToplevel visit_children(print, toplevel)See also
tree_iter()for the iterator variant of this method.
Last update:
2026-01-28