question about speed of sequential string replacement vs regex or

Willem willem at
Wed Sep 28 21:11:27 CEST 2011

Eli the Bearded wrote:
) In comp.lang.perl.misc, Willem  <willem at> wrote:
)> In Perl, it would be applicable.  You see, in Perl, you can call a function
)> in the replacement of the regex substitution, which can then look up the
)> html entity and return the wanted unicode literal.
) A function? I'd use a hash.

A function can return a sensible value for unknown substitutions.
In the case where you prebuild a giant regex or-list, that is not an issue,
but I would match html entities generically.

SaSW, Willem
Disclaimer: I am in no way responsible for any of the statements
            made in the above text. For all I know I might be
            drugged or something..
            No I'm not paranoid. You all think I'm paranoid, don't you !

More information about the Python-list mailing list