caesar0301/treelib

__setitem__ will break bpointers/fpointer

leonardbinet opened this issue · 0 comments

In Tree class, this setter doesn't seem right to me:

    def __setitem__(self, key, item):
        """Set _nodes[key]"""
        self._nodes.update({key: item})

Two issues:

  • we don't check if the item is a tree.node_class instance
  • the node isn't inserted anywhere in the tree, neither node fpointer nor bpointers are updated

Do you have a specific use case in mind?

IMHO we should remove this method which can be misleading for developers.