Skip to content

Instantly share code, notes, and snippets.

@vlagorsse
vlagorsse / timer.py
Created June 14, 2024 14:54
python timer in context manager
from timeit import default_timer
class Timer(object):
def __init__(self, name: str, verbose: bool = True):
self.name = name
self.verbose = verbose
self.timer = default_timer
def __enter__(self):