t9.py is an exploration of words with ambiguous T9 (phone
text interface) encodings. The interesting bit is the scaling
issue... or lack of one: it handled a 230K wordlist, producing 10k
result sets, in about 30 seconds... on an EEEpc. Completely naive
implementation, no optimization (and thus no wasted optimization :-)
I did use string.maketrans
and string.translate
but that
was more because I'd used them before and they're actually a pretty
natural fit for this task. (I did switch from lists to sets, but that
wasn't performance-related either - the wordlist I was working from
had a variety of entries that weren't unique when downcased, and it
didn't occur to me to just use sort -fu
on it.)
Footnotes: