matching one time through a loop

Sean 'Shaleh' Perry shalehperry at attbi.com
Thu May 30 01:34:30 EDT 2002


> 
> If you want to stop at first, then there is no need to count.  Just
> stop.  Also, searching for literal string should be more efficient
> with string.find than more general re stuff.
> 

if you do need the regex, there is only a need to compile it once before any of
the loops rather than every time through.  The way it is now there is no point
in compiling the regex as it is recomputed every time anyway.





More information about the Python-list mailing list