Implement public methods using private methods
111pontes opened this issue · 0 comments
111pontes commented
Overriding some of the current methods can have the nasty side effect of breaking other methods. Let me know if you'd consider having private version of methods used to implement other public methods. Something along the lines of:
def _is_leaf(): ## as currently implemented
...
def is_leaf(): ## children can override without breaking leaves()
return _is_leaf()
def leaves(self, nid=None):
...
if node._is_leaf(self._identifier):
...
This change would be a great enhancement to make the tree more customizable and less likely to breakage. Not a theoretical exercise. Users are actually running into this type of situation. Happy to contribute 😎