Last active
February 7, 2018 19:52
-
-
Save josephcc/3b778a41e4f9faee8dfa1f8784792ff6 to your computer and use it in GitHub Desktop.
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
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