Skip to content

Instantly share code, notes, and snippets.

@jerem
Created January 17, 2014 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jerem/8471656 to your computer and use it in GitHub Desktop.
Save jerem/8471656 to your computer and use it in GitHub Desktop.
timeit decorator
from timeit import Timer
def timeit(func):
def st_func(*args, **keyArgs):
result = list()
def my_func():
result.append(func(*args, **keyArgs))
t = Timer(my_func)
print t.timeit(number=10)
return result[0]
return st_func
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment