idiom for RE matching

Gordon Airporte JHoover at
Thu Jul 26 00:49:18 CEST 2007

Miles wrote:
> On 7/24/07, Gordon Airporte <JHoover at> wrote:
>> I did already find that it speeds things up to pre-test a line like
>> if 'bets' or 'calls' or 'raises' in line:
>>         run the appropriate re's
> Be careful: unless this is just pseudocode, this Python doesn't do
> what you think it does; it always runs the regular expressions, so any
> speed-up is imaginary.

Yes, that's pseudo code even though I didn't really mean it that way 
when I typed it. The actual code uses the proper 'if foo in line or if 
bar in line:' form.

More information about the Python-list mailing list