Skip to content

Instantly share code, notes, and snippets.

View charlee's full-sized avatar

Charlee Li charlee

View GitHub Profile
@charlee
charlee / timethis.py
Created January 8, 2013 21:40
generic decorator with functools.wraps
import functools
def timethis(func):
"""A profiling function used to record the time consumed on a function call."""
@functools.wraps(func)
def _(self, *a, **kw):
start = time()
ret = func(self, *a, **kw)