caesar0301 / treelib

An efficient implementation of tree data structure in python 2/3.
http://treelib.readthedocs.io/en/latest/
Other
812 stars 186 forks source link

Documentation says method name is `tree.all_nodes_iter()`, but it is actually `itr` without an `e` #90

Open GalacticStarfish opened 6 years ago

GalacticStarfish commented 6 years ago

The documentation says the tree class has a method named tree.all_nodes_iter(), but the method name is actually itr without an e

http://treelib.readthedocs.io/en/latest/pyapi.html#tree-objects http://treelib.readthedocs.io/en/latest/pyapi.html#tree.all_nodes_iter

Attempts to call all_nodes_iter() raise AttributeError Recommend creating an alias so that Tree.all_nodes_iter and Tree.all_nodes_itr are references to the same function object.

Inside the tree class just write all_nodes_itr = all_nodes_iter

An alias is a better solution than correcting the documentation, because -- I assure you -- users will sometimes type "iter," out of habit, instead of writing "itr." You can prevent alot of interpreter errors from occurring by making an alias.