Looking around for python implementations of tries just so that I can understand what they are and how they work, I came across Justin Peel\'s patricia trie and found it very in
I believe the bug is in the following snippet of the code you're looking at:
if w.startswith(node[0][:wlen-i],i):
if wlen - i > len(node[0]):
i += len(node[0])
d = node[1]
return True
it should actually be:
if w.startswith(node[0][:wlen-i],i):
if wlen - i > len(node[0]):
i += len(node[0])
d = node[1]
else:
return True