-
-
Save wilig/270811 to your computer and use it in GitHub Desktop.
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
from decorator import decorator | |
import inspect | |
@decorator | |
def deco(f, *a, **kw): | |
# set a default keyword arg | |
if 'foo' not in kw: | |
kw['foo'] = 'bar' | |
return f(*a, **kw) | |
def f(a, b, foo='bleh', foo2='help'): | |
pass | |
f1 = deco(f) | |
print inspect.getargspec(f) | |
print inspect.getargspec(f1) | |
f1(1,2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment