Getting started with python

Ross Ridge rridge at
Tue Apr 17 22:16:15 CEST 2007

James Stroud <jstr... at> 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> 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

					Ross Ridge

 l/  //	  Ross Ridge -- The Great HTMU
[oo][oo]  rridge at
 db  //	  

More information about the Python-list mailing list