Created
June 5, 2012 20:02
-
-
Save j2labs/2877458 to your computer and use it in GitHub Desktop.
name of wrapped fun
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
>>> def deco(method): | |
... def wrapped(*a, **kw): | |
... retval = method(*a, **kw) | |
... return retval | |
... return wrapped | |
... | |
>>> | |
>>> def foo(): | |
... return 4 | |
... | |
>>> foo.__name__ | |
'foo' | |
>>> foo = deco(foo) | |
>>> foo.__name__ | |
'wrapped' | |
>>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment