Created
July 15, 2011 01:13
-
-
Save vls/1083838 to your computer and use it in GitHub Desktop.
python time test decorator function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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