Most efficient method to search text?

Michael Hudson mwh at python.net
Mon Oct 21 08:53:40 EDT 2002


bokr at oz.net (Bengt Richter) writes:

> Thanks. I wonder what would happen if you used word lists and files
> guaranteed *not* to have any hits, so they'd all be searched to the end.
> Or what was your mix (no of search words, length of files, hit distribution)?

Oh, no hits at all.  I was making up random words of length 10.

> >I'm sure Tim once said something along the lines of "Python doesn't
> >give much advice for getting good performance, beyond a not-so-subtle
> >hint to exploit dicts for all they're worth" but I can't find it now.
> >
> There's probably a lot to learn from the dictionary implementation code
> ... one of these days ;-)

Not as much as there is to be learnt from using it, I suspect.

Cheers,
M.

-- 
  I've even been known to get Marmite *near* my mouth -- but never
  actually in it yet.  Vegamite is right out.
 UnicodeError: ASCII unpalatable error: vegamite found, ham expected
                                       -- Tim Peters, comp.lang.python



More information about the Python-list mailing list