Created
March 24, 2017 02:40
-
-
Save hulucc/1f2dee0dfab16818194aab095cfe42f9 to your computer and use it in GitHub Desktop.
python3
This file contains 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
def log(f): | |
def wrapper(*args, **kwargs): | |
print "f address: ", f | |
return f(*args, **kwargs) | |
return wrapper | |
def add(a, b): | |
return a + b | |
add = log(add) | |
add(1, 1) | |
inner_add = add.__closure__[0].cell_contents | |
print inner_add(1, 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment