Skip to content

Instantly share code, notes, and snippets.

@mattrobenolt
Forked from anonymous/wtf.py
Last active December 21, 2015 11:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mattrobenolt/6303154 to your computer and use it in GitHub Desktop.
class A(object):
def hook(self, f):
def intime(*args):
print intime.atime
intime.atime += 1
return f(*args)
intime.atime = 0
return intime
>>> f = A().hook(lambda b: b + 1)
>>> f(1)
0
1
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment