Hacker News new | ask | show | jobs
by css 1871 days 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.
1 comments

Nice! Very expressive way to do n-levels!