Created
April 10, 2020 18:45
-
-
Save chapkovski/75291cfde5b6a9945d4ff1c40508765a to your computer and use it in GitHub Desktop.
simple decorator to measure time spent on method
This file contains 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
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