When using the timeit module, you pass the code you
want to time as strings:
import timeit
t = timeit.Timer(foo(x, y), \
from module import foo
x = 27
y = 45
)
elapsed_time = t.timeit()
This is all very well, but it feels quite unnatural to
me. Why am I passing strings around when functions
Steven D'Aprano wrote:
When using the timeit module, you pass the code you
want to time as strings:
import timeit
t = timeit.Timer(foo(x, y), \
from module import foo
x = 27
y = 45
)
elapsed_time = t.timeit()
This is all very well, but it feels quite unnatural to
me. Why am I
Peter Otten [EMAIL PROTECTED] writes:
Steven D'Aprano wrote:
When using the timeit module, you pass the code you
want to time as strings:
...
This is all very well, but it feels quite unnatural to
me. Why am I passing strings around when functions are
first class objects? Have I missed