-
-
Save blorgblerg/896d4925130001e55aa17c5bf123a2c2 to your computer and use it in GitHub Desktop.
Timer decorator for Python
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 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