Open RichardHoekstra opened 4 years ago
In my own project I am extensively subclassing both 'treelib.Tree' and 'treelib.Node'. Using the 'data' variable, as mentioned in the documentation under advanced usage, does not work well for my use case.
It would make my life easier, and my code prettier, if I can pass additional arguments to Tree.create_node. The dependency injection is already there (self.node_class) and this PR should unlock more of the potential. https://github.com/caesar0301/treelib/blob/017e891fcd5dc613004061cdc42e65cebea48ced/treelib/tree.py#L339-L346
In my own project I am extensively subclassing both 'treelib.Tree' and 'treelib.Node'. Using the 'data' variable, as mentioned in the documentation under advanced usage, does not work well for my use case.
It would make my life easier, and my code prettier, if I can pass additional arguments to Tree.create_node. The dependency injection is already there (self.node_class) and this PR should unlock more of the potential. https://github.com/caesar0301/treelib/blob/017e891fcd5dc613004061cdc42e65cebea48ced/treelib/tree.py#L339-L346