[Tutor] What's the problem with my SpinSpeeds.py?
rdm at rcblue.com
Tue Aug 3 10:31:08 CEST 2004
Alan Gauld wrote at 11:21 8/2/2004:
> > t = Timer("countUsingRange(n)", "from __main__ import
> > countUsingRange, n")
> > rangeTime = t.timeit(repetitions)
>This executes and times the string
>after first executing
>"from __main__ import countUsingRange, n".
Thank you for clearing up some of the mystery. The basic one for me is
what it means to execute a string, as in, 'This executes and times the string
"countUsingRange(n)"'. And why does Timer take arguments that are in
quotes, (which makes them strings, I suppose). It seems that my
discovery of the timeit module has gotten me in over my head, IOW ahead
of myself in my learning of Python.
More information about the Tutor