.... def wrapper(*args, **kwargs):>>def negate(func):
.... return not func(*args, **kwargs)
.... return wrapper
....
.... return x 10>>def f(x):
....
False>>g = negate(f)
g(20)
True>>g(5)
Now g has the argument signature of (*args, **kwargs). Pop-up help in
Python
Scripter(which is great by the way) tells me this, as does
('args', 'kwargs')>>g.func_code.co_varnames
Is there anyway to fix this in negate? I assume that I can't just start
changing things in g.func_code since the bytecodes depend on the order
of variables and lots of other stuff that I don't claim to understand.
Please note: From the new functools module, I see that one can set/update
__module__, __name__, __doc__, and __dict__ using the corresponding
attributes
from the wrapped function; however, none these fix up the argument signature
do they? (I'm still running 2.4, so I haven't tried it.)
Thanks,
Gerard