using timeit for a function in a class
flupke
flupke at nonexistingdomain.com
Thu May 26 08:54:17 EDT 2005
Hi,
i tried to use timeit on a function in a class but it doesn't do what i
think it should do ie. time :)
In stead it starts printing line after line of hello time test!
What am i doing wrong in order to time the f function?
class TimeTest(object):
def f(self):
print "hello time test!"
if __name__ == '__main__':
from timeit import Timer
s = """
test = TimeTest()
test.f()
"""
t = Timer(s,"from __main__ import TimeTest")
print t.timeit()
Regards,
Benedict Verheyen
More information about the Python-list
mailing list