Tree lookup

Lookup will follow a path and return whatever node it is pointing to.
This commit is contained in:
Bryan Schumaker 2010-11-11 22:49:58 -05:00
parent bcacfafa36
commit 1f7d6538c4
1 changed files with 7 additions and 0 deletions

View File

@ -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):