Re: [Tutor] timeit at the command line

2006-10-03 Thread Kent Johnson
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 -sx=0 while x100: x+=1 1000 loops, best of 3: 0.116 usec per loop python -m timeit x=0 while

Re: [Tutor] timeit at the command line

2006-10-03 Thread Dick Moores
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 -sx=0 while x100: x+=1 1000 loops, best of 3:

Re: [Tutor] timeit at the command line

2006-10-03 Thread Kent Johnson
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 first

Re: [Tutor] timeit at the command line

2006-10-03 Thread Dick Moores
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 == 100 after the

Re: [Tutor] timeit at the command line

2006-10-03 Thread Kent Johnson
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 -sfor x in range(1): x*x Traceback (most recent call last): File

Re: [Tutor] timeit at the command line

2006-10-03 Thread Dick Moores
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 -sfor x in range(1): x*x Traceback (most recent

Re: [Tutor] timeit at the command line

2006-10-03 Thread Kent Johnson
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 -sfor x in range(1):

Re: [Tutor] timeit at the command line

2006-10-03 Thread Dick Moores
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 any setup:

Re: [Tutor] timeit at the command line

2006-10-02 Thread Kent Johnson
Dick Moores wrote: C:\python -m timeit -sx=0 while x100: x+=1 1000 loops, best of 3: 0.123 usec per loop C:\python -m timeit -sfor x in range(100): x+=1 Traceback (most recent call last): File E:\Python25\lib\runpy.py, line 95, in run_module filename, loader, alter_sys)

Re: [Tutor] timeit at the command line

2006-10-02 Thread Dick Moores
At 03:08 AM 10/2/2006, Kent Johnson wrote: Dick Moores wrote: C:\python -m timeit -sx=0 while x100: x+=1 1000 loops, best of 3: 0.123 usec per loop C:\python -m timeit -sfor x in range(100): x+=1 Traceback (most recent call last): File E:\Python25\lib\runpy.py, line 95,

Re: [Tutor] timeit at the command line

2006-10-02 Thread Dick Moores
At 01:50 PM 10/2/2006, John Fouhy wrote: On 02/10/06, Dick Moores [EMAIL PROTECTED] wrote: C:\python -m timeit -sfor 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: python -m timeit for

[Tutor] timeit at the command line

2006-10-01 Thread Dick Moores
C:\python -m timeit -sx=0 while x100: x+=1 1000 loops, best of 3: 0.123 usec per loop C:\python -m timeit -sfor x in range(100): x+=1 Traceback (most recent call last): File E:\Python25\lib\runpy.py, line 95, in run_module filename, loader, alter_sys) File