On Dec 10, 5:07 pm, jelsas <[EMAIL PROTECTED]> wrote: > Hi -- I can't seem to maintain the function signature when applying a > decorator. I'm using functools.wraps. Example: > > >>> def mydecorator(fn): > > ... from functools import wraps > ... # simple decorator > ... @wraps(fn) > ... def wrapped(*args, **kwargs): > ... print 'i\'m wrapped!' > ... return fn(*args, **kwargs) > ... return wrapped > ... > > >>> @mydecorator > > ... def f(foo, bar): > ... '''docstring for f''' > ... pass > ... > > > > >>> help(f) > > displays: > > Help on function f in module __main__: > > f(*args, **kwargs) > docstring for f > > I would like to maintain f's signature in the help message, (foo, bar) > instead of (*args, **kwargs) > > Thanks in advance!
You want the decorator module: http://www.phyast.pitt.edu/~micheles/python/documentation.html -- http://mail.python.org/mailman/listinfo/python-list