Tree lookup
Lookup will follow a path and return whatever node it is pointing to.
This commit is contained in:
parent
bcacfafa36
commit
1f7d6538c4
|
@ -47,6 +47,13 @@ class Tree(dict):
|
|||
if len(path) > 1:
|
||||
child.insert(path[1:])
|
||||
|
||||
def lookup(self, path):
|
||||
print self.keys(), path
|
||||
child = self[path[0]]
|
||||
if len(path) > 1:
|
||||
return child.lookup(path[1:])
|
||||
return child
|
||||
|
||||
|
||||
class DLTree(Tree):
|
||||
def __init__(self):
|
||||
|
|
Loading…
Reference in New Issue