Skip to content

Instantly share code, notes, and snippets.

@josephcc
Last active February 7, 2018 19:52
Show Gist options
  • Save josephcc/3b778a41e4f9faee8dfa1f8784792ff6 to your computer and use it in GitHub Desktop.
Save josephcc/3b778a41e4f9faee8dfa1f8784792ff6 to your computer and use it in GitHub Desktop.
import functools
def dec(f):
i = dict()
i['a'] = 0
@functools.wraps(f)
def wrap(*args):
i['a'] = i['a'] + 1
print i
return f(*args)
return wrap
def fff():
print 'a'
bbb = dec(fff)
bbb()
bbb()
bbb()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment