What is built-in method sub

Grant Edwards invalid at invalid.invalid
Mon Jan 11 16:01:04 EST 2010


On 2010-01-11, Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> wrote:

[regarding profiling results]

> I think you'll find that Python's regex engine is pretty much
> optimised as well as it can be, short of a major re-write. But
> to quote Jamie Zawinski:
>
>     Some people, when confronted with a problem, think "I know, 
>     I'll use regular expressions." Now they have two problems.
>
> The best way to optimize regexes is to use them only when
> necessary. They are inherently an expensive operation, a
> mini-programming language of it's own. Naturally some regexes
> are more expensive than others: some can be *really*
> expensive, some are not.

And for all pracitacal purposes, you can't tell which is which.
At least not for any value of "you" I've run into...

-- 
Grant Edwards                   grante             Yow! I'm in direct contact
                                  at               with many advanced fun
                               visi.com            CONCEPTS.



More information about the Python-list mailing list