At 07:08 AM 10/3/2006, Kent Johnson wrote:
>Dick Moores wrote:
> > At 05:54 AM 10/3/2006, Kent Johnson wrote:
> >> Dick Moores wrote:
> >>> Very interesting. I thought a line of that template looked
> >>> familiar. I was seeing "_t0 = _timer()" regularly when I had the -s
> >>> option set without a
Dick Moores wrote:
> At 05:54 AM 10/3/2006, Kent Johnson wrote:
>> Dick Moores wrote:
>>> Very interesting. I thought a line of that template looked
>>> familiar. I was seeing "_t0 = _timer()" regularly when I had the -s
>>> option set without any setup:
>>> C:\>python -m timeit -r 3 -s"for x in
At 05:54 AM 10/3/2006, Kent Johnson wrote:
>Dick Moores wrote:
>>Very interesting. I thought a line of that template looked
>>familiar. I was seeing "_t0 = _timer()" regularly when I had the -s
>>option set without any setup:
>>C:\>python -m timeit -r 3 -s"for x in range(1):" " x*x"
>>Traceb
Dick Moores wrote:
> Very interesting. I thought a line of that template looked familiar.
> I was seeing "_t0 = _timer()" regularly when I had the -s option set
> without any setup:
>
> C:\>python -m timeit -r 3 -s"for x in range(1):" " x*x"
> Traceback (most recent call last):
>File "E
At 04:35 AM 10/3/2006, Kent Johnson wrote:
>Dick Moores wrote:
> > At 03:05 AM 10/3/2006, Kent Johnson wrote:
> >> timeit runs the setup code once, then runs the timed code many times
> >> with the timer running. If "x=0" is outside the loop, then the while
> >> loop only runs once, because x == 10
Dick Moores wrote:
> At 03:05 AM 10/3/2006, Kent Johnson wrote:
>> timeit runs the setup code once, then runs the timed code many times
>> with the timer running. If "x=0" is outside the loop, then the while
>> loop only runs once, because x == 100 after the first time through the
>> loop. So your
At 03:05 AM 10/3/2006, Kent Johnson wrote:
>Dick Moores wrote:
> > I DID have setup code, the "x=0". I now notice that if the "x=0" is
> > not stated as the setup code, the time difference is enormous,
> > 132-to-1 in this case.
> >
> > python -m timeit -s"x=0" "while x<100:" " x+=1"
> > 100
Dick Moores wrote:
> I DID have setup code, the "x=0". I now notice that if the "x=0" is
> not stated as the setup code, the time difference is enormous,
> 132-to-1 in this case.
>
> python -m timeit -s"x=0" "while x<100:" " x+=1"
> 1000 loops, best of 3: 0.116 usec per loop
>
> python -
At 01:50 PM 10/2/2006, John Fouhy wrote:
>On 02/10/06, Dick Moores <[EMAIL PROTECTED]> wrote:
>>C:\>python -m timeit -s"for x in range(100):" "x+=1"
>>Traceback (most recent call last):
>
>The -s option specifies the setup code. In this case, you don't have
>any setup code. Try this:
>
>pytho
At 03:08 AM 10/2/2006, Kent Johnson wrote:
>Dick Moores wrote:
> > C:\>python -m timeit -s"x=0" "while x<100:" " x+=1"
> > 1000 loops, best of 3: 0.123 usec per loop
> >
> > C:\>python -m timeit -s"for x in range(100):" "x+=1"
> > Traceback (most recent call last):
> >File "E:\Python2
Dick Moores wrote:
> C:\>python -m timeit -s"x=0" "while x<100:" " x+=1"
> 1000 loops, best of 3: 0.123 usec per loop
>
> C:\>python -m timeit -s"for x in range(100):" "x+=1"
> Traceback (most recent call last):
>File "E:\Python25\lib\runpy.py", line 95, in run_module
> filename
11 matches
Mail list logo