On 07/11/06, Jonathon Sisson <[EMAIL PROTECTED]> wrote: > Just out of curiousity (since I really can't say myself), does the code > below import re each time it loops? I ran the same commands and saw > quite similar results (0.176 usec per loop for the first test and 0.993 > usec per loop for the second test), and I was just curious if that > import (and the re.compile, for that matter) happen with each loop?
Nope. Here's the command again: python -m timeit -s 'import re' -s 'r = re.compile("[0-9A-Za-z_.-]")' 'r.match("J")' -s means "startup code". So, 'import re' and 're.compile(...)' happen only once, before the main test starts. You can read help on timeit by typing 'import timeit; help(timeit)' in the python console. -- John. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor