Last active
August 7, 2018 18:49
-
-
Save vlad-bezden/fd63ba037ed6c5f083a4f037b3674ddd to your computer and use it in GitHub Desktop.
python timer contextmanager
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
from contextlib import contextmanager | |
import time | |
@contextmanager | |
def timer(): | |
start = time.time() | |
yield | |
print(f'\N{greek capital letter delta}t \N{rightwards arrow} {time.time() - start:.2f}s') |
Author
vlad-bezden
commented
Aug 7, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment