Skip to content

Instantly share code, notes, and snippets.

@rosemichaele
Created September 6, 2017 14:20
Show Gist options
  • Save rosemichaele/489ea98307e30df3350ca0959c82edf2 to your computer and use it in GitHub Desktop.
Save rosemichaele/489ea98307e30df3350ca0959c82edf2 to your computer and use it in GitHub Desktop.
Timing function intended to be used as a decorator.
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