Created
August 8, 2020 07:49
-
-
Save wila-diaz/bbf341af0118b24e4a4f44728ec1d854 to your computer and use it in GitHub Desktop.
Time Controller Decorator
This file contains hidden or 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
def controller_time(func): | |
def wrapper(*args, **kwargs): | |
initial_time = time.time() | |
func(*args,**kwargs) | |
final_time = time.time() | |
seconds = final_time - initial_time | |
print(f'The function {func.__name__} took {seconds} seconds') | |
return wrapper |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment