Skip to content

Instantly share code, notes, and snippets.

@vls
Created July 15, 2011 01:13
Show Gist options
  • Save vls/1083838 to your computer and use it in GitHub Desktop.
Save vls/1083838 to your computer and use it in GitHub Desktop.
python time test decorator function
import time, functools
def timeit(func):
@functools.wraps(func)
def __do__(*args,**kwargs):
start = time.time()
result= func(*args,**kwargs)
print '%s used time %ss'%(func.__name__,time.time()-start)
return result
return __do__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment