[Tutor] Tree again: iterator, yield, increase (treelib)
chris2014 at postbox.xyz
Sat Oct 14 11:44:33 EDT 2017
I've a question about treelib library from pip.
Treelib stores a tree and offers functions to add, delete or move
nodes. Furthermore, you can print a tree like this:
│ ├── Jane2.1
│ │ └── Jane2.1.1
│ ├── Jane2.2
│ └── Jane2.3
I'm trying to understand how the print function is working.
1. The documentation  says, you have to call tree.show() to print
the tree above.
2. tree.show calls the self__print_backend(...)
3. It seems that nid is initialized in get_iter, Line 218 
4. nid is passed as parameter to __get_iter and the other
5. the node with the id nid is fetched in line 222.
6. In Line 190 there's a loop.
I don't understand what increments nid or what makes the __get_iter
function loop through the self._nodes dictionary defined in Line 106?
Couldn't the __get_iter function iterate another list or dictionary?
Which line says that you want to get every Node in self._nodes?
Thank you in advance!
More information about the Tutor