In the following example code below, we have an undecorated function fun()
and a decorated one wrappedfun()
.
For the undecorated function fun
, pressing TAB in IPython notebook after the opening parenthesis following the function name shows the call signature as fun(x=0, y=1)
but for the decorated version wrappedfun
you get the completion as wrappedfun(*args, **kwargs)
. Is there any way to tell IPython to display the original call signature during TAB completion?
from functools import wraps
def mywrapper(func):
''' simple wrapper '''
@wraps(func)
def wrapper(*args, **kwargs):
print('inside wrapper')
return func(*args, **kwargs)
return wrapper
def fun(x=0, y=1):
''' Docstring for fun '''
return x + y
@mywrapper
def wrappedfun(x=0, y=1):
''' Docstring for wrapped another fun '''
return x + y