S
silverburgh.meryl
Hi,
I have a function in my python like this:
def callFunc(line, no):
# some code
And I want to do a performance test like this:
for line in f:
for i in range(int(count)):
t1 = timeit.Timer("callFunc(line, i)","from __main__
import callFunc")
r1 = t1.timeit();
print r1;
but when I run it, it can't recognize the parameter 'line' and 'i',
can you please tell me how to fix it? i get this error:
File "/usr/lib/python2.4/timeit.py", line 161, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 6, in inner
NameError: global name 'line' is not defined
Thank you.
I have a function in my python like this:
def callFunc(line, no):
# some code
And I want to do a performance test like this:
for line in f:
for i in range(int(count)):
t1 = timeit.Timer("callFunc(line, i)","from __main__
import callFunc")
r1 = t1.timeit();
print r1;
but when I run it, it can't recognize the parameter 'line' and 'i',
can you please tell me how to fix it? i get this error:
File "/usr/lib/python2.4/timeit.py", line 161, in timeit
timing = self.inner(it, self.timer)
File "<timeit-src>", line 6, in inner
NameError: global name 'line' is not defined
Thank you.