timing a function with timeit? (newbie problem)

news.west.cox.net mark at hahnca.com
Wed Aug 27 19:45:17 EDT 2003


Why do I get the exception "global name 'test' is not defined" in this code
(next to last line) and how do I fix it?

import timeit
def test():
   x=2+2
t = timeit.Timer('test()')
print t.timeit()






More information about the Python-list mailing list