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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to