Skip to content

Instantly share code, notes, and snippets.

@ngc696
Created April 6, 2014 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ngc696/10010488 to your computer and use it in GitHub Desktop.
Save ngc696/10010488 to your computer and use it in GitHub Desktop.
__author__ = 'Evgeny Chernigovsky'
import time
def time_decorator(func):
def wrap(*args, **kwargs):
start_time = time.time()
func(*args, **kwargs)
end_time = time.time()
pattern = 'Function {0} was called with args:\n{1}\nand kwargs:\n{2}\nExecution time:\n{3}'
print(pattern.format(func.__name__, args, kwargs, end_time - start_time))
return wrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment