Created
April 21, 2016 18:45
-
-
Save winogradoff/8ea1372676bdc6b3a59a86d79a0a5f64 to your computer and use it in GitHub Desktop.
Python timit decorator
This file contains hidden or 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
def timeit(f): | |
def timed(*args, **kw): | |
ts = time.time() | |
result = f(*args, **kw) | |
te = time.time() | |
print("function time {} : {} sec".format(f.__name__, te - ts)) | |
return result | |
return timed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment