When Python outruns C++ ...
Jp Calderone
exarkun at intarweb.us
Tue Apr 1 15:27:49 EST 2003
On Tue, Apr 01, 2003 at 12:07:57PM -0800, Jeremy Fincher wrote:
> Jp Calderone <exarkun at intarweb.us> wrote in message news:<mailman.1049181423.2644.python-list at python.org>...
> > It looks like this could easily be improved with the application of a
> > slightly smarter searching algorithm, such as Rabin-Karp search or
> > Boyer-Moore find.
>
> These searches depend on a fixed needle to search for in the haystack.
> They can't be applied to a regular expression search.
Quite true. However, a regular expression is by no means the only way
to break a string up into "words". For this simple task, I think either of
the above mentioned algorithms will work. For more complex ones, involving
really complex regular expressions, perhaps not.
Jp
--
Lowery's Law:
If it jams -- force it. If it breaks, it needed replacing anyway.
--
up 12 days, 16:00, 6 users, load average: 0.05, 0.14, 0.14
More information about the Python-list
mailing list