When I wrap a function with @ , how do I make the wrapper function look and feel just like a wrapped function? help(function) in particular.
Some codes:
>>> def wraps(f): def call(*args, **kw): print('in', f, args, kw)
Motivation. It would be nice to see the arguments when the help window appears, when I type f( * plopp *, I see (a, b = 1, g = g, *args, **kw) . (In this case, in the Python IDLE shell)
I looked at the inspect module, which helps me with good formatting. The problem still exists: how do I do this with the arguments.
Passing arguments to a mutable default value like def f(d = {}): should not work, because I pass arguments to another process, and in any case, the loss will be lost.
python
User May 31 '14 at 18:59 2014-05-31 18:59
source share