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

Disable sorting per default #111

Open villmow opened 5 years ago

villmow commented 5 years ago

Problem: If you call str(tree), it is sorted per default. There is no way of obtaining an unsorted string representation of a tree. The __print_backend function is private and can't be called from outside.

The problem is the the sorting parameter in expand_tree(), which is called by many functions, that don't pass the parameters to expand_tree (to_graphviz, leaves, subtree).

Furthermore the interface to sorting is really messed up (the name of the parameter):

erhant commented 3 years ago

I upvote that sorting should be disabled by default. I had a hard time trying to obtain an unsorted tree.show()