treelib icon indicating copy to clipboard operation
treelib copied to clipboard

New Tree.children_itr method

Open cowo78 opened this issue 5 years ago • 2 comments

In case creating a list like Tree.children() does is too heavy for efficiency reasons.

cowo78 avatar Sep 12 '19 08:09 cowo78

It seems as duplicated as method children which could convert into an iterator via iter(childrenI())

caesar0301 avatar Dec 01 '19 06:12 caesar0301

Not really. Doing an iter(children()) would first create a list then iterate over it while children_itr() would just create the iterator. In the first case memory usage is O(N), in the second is O(1).

cowo78 avatar Dec 02 '19 07:12 cowo78