3 ms·
This is really cool, I used it to implement a (very) basic trie: trie_struct: Callable = lambda: defaultdict(trie_struct) trie = trie_struct() fo
by css 5y ago
This is really cool, I used it to implement a (very) basic trie:
trie_struct: Callable = lambda: defaultdict(trie_struct)
trie = trie_struct()
for word in words:
ref = trie
for char in word:
ref = ref[char]
It won't work with words that substring other words, but its interesting.
- abcxjeb284 5y agoNice! Very expressive way to do n-levels!