Getting started with python
Ross Ridge
rridge at caffeine.csclub.uwaterloo.ca
Tue Apr 17 16:16:15 EDT 2007
James Stroud <jstr... at mbi.ucla.edu> wrote:
>py> t = timeit.Timer(stmt=s)
>py> print "%.2f usec/pass" % (1000000 * t.timeit(number=100000)/100000)
>40.88 usec/pass
7stud <bbxx789_05ss at yahoo.com> wrote:
>What does this accomplish:
>
>1000000 * t.timeit(number=100000)/100000
>
>that the following doesn't accomplish:
>
>10 * t.timeit(number=100000)
The first example converts from seconds per 100000 passes to microseconds
per pass in two steps, while the second example does it one. The first
example is more easily understood and maintainable than the second
example.
Ross Ridge
--
l/ // Ross Ridge -- The Great HTMU
[oo][oo] rridge at csclub.uwaterloo.ca
-()-/()/ http://www.csclub.uwaterloo.ca/~rridge/
db //
More information about the Python-list
mailing list