New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
%pdoc np.ma.compress shows docstring twice #89
Comments
The object implements a .getdoc() method. Are there actually any cases where .getdoc() adds info to the normal docstring, or can we simplify it to only check .getdoc() if it doesn't get a normal docstring. Otherwise, one possible way round this is to use |
@takluyver, agreed: we should probably change our behavior and only call getdoc if we didn't get a docstring. Should be an easy fix. |
I wonder if we should possibly prefer |
That's a good point. I think it's fairly rare, so anyone implementing it must have had a good reason to do it, and we might as well honor it. Since using both is definitely a bug, I agree we could go with letting getdoc take precedence, unless what it returns is not a string, case in which we fall back to |
If object has a getdoc() method, use its return value (as long as it's a string) as the object's docstring. Closes ipythongh-89 (duplicate docstrings when objects have getdoc).
Original Launchpad bug 521612: https://bugs.launchpad.net/ipython/+bug/521612
Reported by: fdo.perez (Fernando Perez).
No idea why, but querying np.ma.compress with ? or %pdoc double-prints the docstring, with the second copy indented.
See this numpy thread for some context:
http://mail.scipy.org/pipermail/numpy-discussion/2010-February/048634.html
That object has a runtime-generated docstring, but I checked and its doc is OK (no duplication there). So the bug is definitely ours.
The text was updated successfully, but these errors were encountered: