search versus match in re module

John Machin sjmachin at lexicon.net
Sun Nov 26 05:00:09 EST 2006


John Machin wrote:
[snip]
> 2. Then realise that your test is equivalent to
>
> if not line.startswith('^From '):

Whoops!

That '^From ' (and all later ones) should have been 'From '

(the perils of over-hasty copy/paste)

The timings are, if anything, a tiny bit faster than before.

Cheers,
John




More information about the Python-list mailing list