On 04/21/2015 09:31 PM, Ganesh Pal wrote:
> Iam not able to understand what  why only 10 loops were run ? what
> does this mean and how  does this work ?

I have a hunch you're mistakenly thinking that Python is only running
through ten iterations of your for i in range(1000000) loop.  This is
not the case.  The entire thing is running (all 1000000 iterations of
your loop), but is run ten times, as that is the default for timeit
unless you specify that you want to run it more times.  Hope this helps.

Basically timeit is doing something like this:

def mycode():
    for i in range(1000000):
        pass

for x in range(10):
     mycode()

And then collecting timing statistics on the ten passes.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to