Created
September 6, 2017 14:20
-
-
Save rosemichaele/489ea98307e30df3350ca0959c82edf2 to your computer and use it in GitHub Desktop.
Timing function intended to be used as a 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 timing(f): | |
from time import time | |
def timed(*args, **kwargs): | |
start = time() | |
r = f(*args, **kwargs) | |
end = time() | |
print("Time elapsed: {} seconds".format(end-start)) | |
return r | |
return timed | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment