Skip to content

Instantly share code, notes, and snippets.

View fmder's full-sized avatar

François-Michel De Rainville fmder

  • Québec, Canada
View GitHub Profile
@fmder
fmder / count_calls.py
Created November 2, 2011 14:25
Count function calls decorator
class countCalls(object):
"""Decorator that keeps track of the number of times a function is called.
::
>>> @countCalls
... def foo():
... return "spam"
...
>>> for _ in range(10)
... foo()