Currently, all elements in the tree are printed with print_tree.
It would be nice if there were support for an optional argument, say filter which is called before displaying any given tree element. You could then do:
def should_print_node(node):
return node.someProperty != None
pptree.print_tree(tree, filter=should_print_node)
To only print out node which have a given property. This is useful in filtering the tree without having to manually traverse it and remove child nodes in order to get the "filtered" output.
Currently, all elements in the tree are printed with
print_tree.It would be nice if there were support for an optional argument, say
filterwhich is called before displaying any given tree element. You could then do:To only print out node which have a given property. This is useful in filtering the tree without having to manually traverse it and remove child nodes in order to get the "filtered" output.