Линейное сканирование медленное, но дерево префиксов, вероятно, излишне. Сохранение отсортированных слов и использование бинарного поиска - это быстрый и простой компромисс.
import bisect
words = sorted(map(str.strip, open('/usr/share/dict/words')))
def lookup(prefix):
return words[bisect.bisect_left(words, prefix):bisect.bisect_right(words, prefix+'~')]
>>> lookup('abdicat')
['abdicate', 'abdication', 'abdicative', 'abdicator']