Skip to content

Instantly share code, notes, and snippets.

@chapkovski
Created April 10, 2020 18:45
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 chapkovski/75291cfde5b6a9945d4ff1c40508765a to your computer and use it in GitHub Desktop.
Save chapkovski/75291cfde5b6a9945d4ff1c40508765a to your computer and use it in GitHub Desktop.
simple decorator to measure time spent on method
import time
def time_check(func):
def wrapper(*args, **kwargs):
start_time = time.time()
func(*args, **kwargs)
print(f"Time spent on {func.__name__}: {(time.time() - start_time)} seconds ---")
return wrapper
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment