When to compile regex?

Fredrik Lundh effbot at telia.com
Sun Feb 13 07:11:31 EST 2000


David Shochat <shochat at chelmsford.com> wrote:
> In section 4.2.3 of the Python Library Reference (1.5.2) it says that
> using compile is more efficient "when the expresion will be used several
> times in a single program". I'm trying to figure out the intended
> meaning of this.

rule 1: always compile regular expressions

rule 2: for throw-away scripts, or any situation where
programmer time is more important that execution time,
ignore rule 1.

</F>





More information about the Python-list mailing list