Steven Bethard <[EMAIL PROTECTED]> writes:

> $ python -m timeit "for x in (i for i in xrange(10)): y = x"
> 100000 loops, best of 3: 4.75 usec per loop

Yowza! One of the features I really liked in Perl has shored Python island
somewhere in the 2.4'ies, it seems[1]. Thanks for the tip!

PS. In case it wasn't clear what I referred to, it was the ability to run
given module as a script. Of course you could supply full path to timeit.py: 

$ python2.3 /usr/lib/python2.3/timeit.py \ 
  "for x in [i for i in xrange(10)]: y = x" 
100000 loops, best of 3: 9.96 usec per loop

But using -m makes it much more convenient.


Footnotes: 
[1]  Well, not exactly equal to -M in Perl, but close enough for timing stuff

-- 
# Edvard Majakari               Software Engineer
# PGP PUBLIC KEY available      Soli Deo Gloria!
You shouldn't verb verbs.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to