caesar0301 / treelib

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

Call node "display" method instead of returning node "data_property" to have more flexibility #149

Open leonardbinet opened 4 years ago

leonardbinet commented 4 years ago

I am currently limited by how a tree is represented in show method. Currently, the __print_backend method displays a node based on his tag or a data_property.

In my case, I want to change display based on node depth in current tree.

One possibility to keep retro-compatibility would be to implement a display method on Node, returning by default the tag, with ability return a provided data_property, remaining **kwargs would allow specifying client defined behaviours by redefining display method by Node inheritance.