On 07/11/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> If anyone really cares which Python implementation is faster, the timeit
> module is your friend. Assertions like "would probably be faster" or
> "it's also quicker" don't hold much weight. In Python, if you want to
> know what is faster, you must test.

Hmm, what exactly is the contentious code?

Morpork:~ repton$ python -m timeit -s
's="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.-"'
'"J" in s'
1000000 loops, best of 3: 0.295 usec per loop
Morpork:~ repton$ python -m timeit -s 'import re' -s 'r =
re.compile("[0-9A-Za-z_.-]")' 'r.match("J")'
1000000 loops, best of 3: 1.16 usec per loop

-- 
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to