Skip to content

Instantly share code, notes, and snippets.

@hulucc
Created March 24, 2017 02:40
Show Gist options
  • Save hulucc/1f2dee0dfab16818194aab095cfe42f9 to your computer and use it in GitHub Desktop.
Save hulucc/1f2dee0dfab16818194aab095cfe42f9 to your computer and use it in GitHub Desktop.
python3
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