mne-python icon indicating copy to clipboard operation
mne-python copied to clipboard

IPython shows decorator docstring instead of function docstring

Open mluessi opened this issue 14 years ago • 8 comments

We recently implemented the verbose option using a decorator. I just noticed that IPython now shows the decorator docstring instead of the function docstring, e.g, mne.minimum_norm.apply_inverse?? shows the docstring of verbose().

This seems to be a problem with IPython but it would be good if we can find a way to fix it before the release.

mluessi avatar Dec 04 '12 14:12 mluessi

The problem only happens when ?? is used (show the code), just ? works fine.

mluessi avatar Dec 04 '12 15:12 mluessi

did you try to google it?

agramfort avatar Dec 04 '12 16:12 agramfort

Yes, using functools.wraps handles the docstring but IPython gets the wrong source when ?? is used, see ipython/ipython#1555

mluessi avatar Dec 04 '12 17:12 mluessi

Thanks for catching and redirecting this, I should have opened an issue instead of just sending thoughts to the list ;-)

dengemann avatar Dec 04 '12 19:12 dengemann

(for clarification: I sent a mail with about the same content but without PR or issue yesterday, presumably you will have missed and this was based on an independent observation...) Anyways, excellent, this was quite annoying.

dengemann avatar Dec 04 '12 20:12 dengemann

good.. I was wondering what you were talking about ;-)

mluessi avatar Dec 04 '12 20:12 mluessi

Arrgh, it was too self evident to me, then after one minute or so I realize what I wrote was somewhat ambiguous. Sorry for the confusion. LOL

On Tue, Dec 4, 2012 at 9:14 PM, Martin Luessi [email protected]:

good.. I was wondering what you were talking about ;-)

— Reply to this email directly or view it on GitHubhttps://github.com/mne-tools/mne-python/issues/215#issuecomment-11013736.

dengemann avatar Dec 04 '12 20:12 dengemann

The argument list still shows the generic (_args, *_kwargs) from the decorator..Though the doctring tends to have enough information, it would be nice to see the original list of arguments from the function to know which parameters are the kwargs, and which are positional args and what the defaults may be. Is that something easily achieved?

haribharadwaj avatar Dec 06 '13 22:12 haribharadwaj