[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: using timeit for a function in a class
From: flupke <flupke () nonexistingdomain ! com>
Date: 2005-05-26 12:54:17
Message-ID: ZFjle.101596$KL7.6197297 () phobos ! telenet-ops ! be
[Download RAW message or body]
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
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic