Curious to see alternate approach on a search/replace via regex
Dave Angel
davea at davea.name
Fri Feb 8 01:27:44 EST 2013
On 02/07/2013 06:13 PM, rh wrote:
> On Fri, 08 Feb 2013 09:45:41 +1100
> Steven D'Aprano <steve+comp.lang.python at pearwood.info> wrote:
>
>> <snip>
>>
>> But since you don't demonstrate any actual working code, you could be
>> correct, or you could be timing it wrong. Without seeing your timing
>> code, my guess is that you are doing it wrong. Timing code is tricky,
>> which is why I always show my work. If I get it wrong, someone will
>> hopefully tell me. Otherwise, I might as well be making up the
>> numbers.
>
> re.compile
That statement does explicitly nothing useful. It certainly doesn't
compile anything, or call any regex code.
> starttime = time.time()
> for i in range(numloops):
> u2f()
>
> msg = '\nElapsed {0:.3f}'.format(time.time() - starttime)
> print(msg)
>
--
DaveA
More information about the Python-list
mailing list