[issue40257] Improve the use of __doc__ in pydoc

Matthias Bussonnier report at bugs.python.org
Mon May 11 12:24:39 EDT 2020


Matthias Bussonnier <bussonniermatthias at gmail.com> added the comment:

> Can you all please decide which issue to use?

We can stay here, I opened the other issue before figuring out this was the cause.

> If IPython wants to output the help on the instance, it should change the implementation of `?` and `??`. It would be better if it correctly attribute the source of the docstring: the object itself, its class or its superclass. It was difficult to distinguish these cases before, now it is easier.

Sure I can do that, but this issue feel like a important semantic change of `inspect.getdoc()`, it may be documented but there is no warning or deprecation of behavior. It is also likely to affect untested code (documentation generation).

If you decide that this change of behavior is the one you want I'll be happy to support you – I just want to make sure the impact on the rest of the ecosystem. IPython/Jupyter is likely not the only one to rely on inspect.getdoc behavior, I'm thinking pycharm, spyder, sphinx will likely be impacted. I can see `inspect.getdoc()` in the source of even scipy/numpy and rarely in tests.


I would prefer new functions with clearer behavior and for example returning a sequence of tuple (docs, where it comes from) potentially deprecating inspect.getdocs() than a change of behavior that remove data where their used to be some


>  I just tried IPython 5.5.0

(You may want to update to 5.10, and do you have reason to still be on 5 and not 7 ?)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40257>
_______________________________________


More information about the Python-bugs-list mailing list