If you need the below-described functionality immediately, something
like the following should work:
nodes = [nd for nd in tree if filter_fn(nd)]
or equivalently:
nodes = [nd for nd in tree.preorder_node_iter(filter_fn)]
Of course, if you do not need the entire collection of nodes, then
simply passing the filter function to the iterator works as well:
for nd in tree.preorder_node_iter(filter_fn):
... do stuff here ...
On 9/4/15 1:18 PM, Yan Wong wrote: