Skip to content

Instantly share code, notes, and snippets.

@blorgblerg
Created July 28, 2017 21:15
Show Gist options
  • Save blorgblerg/896d4925130001e55aa17c5bf123a2c2 to your computer and use it in GitHub Desktop.
Save blorgblerg/896d4925130001e55aa17c5bf123a2c2 to your computer and use it in GitHub Desktop.
Timer decorator for Python
import time
def timeme(some_function):
"""Place above function definition."""
def time_function(*args,**kwargs):
starttime = time.time()
print('Timed: {} s. '.format(time.time() - starttime))
return some_function(*args, **kwargs)
return time_function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment