This prints modname.__doc__ / help(modname) / inspect.getdoc(modname) with IPython / Jupyter + ipykernel:

>>> modname?

This prints something like inspect.getsource(modname)

>>> modname??

https://ipython.readthedocs.io/en/stable/interactive/python-ipython-diff.html#accessing-help

https://docs.python.org/3/library/inspect.html

If an object defines a _repr_pretty_() method, IPython will call that instead of __repr__()
https://ipython.readthedocs.io/en/stable/config/integrating.html#rich-display



On Thu, Apr 2, 2020, 4:30 PM Abdur-Rahmaan Janhangeer <arj.python@gmail.com> wrote:

Kind Regards,

Abdur-Rahmaan Janhangeer
Mauritius


On Thu, Apr 2, 2020 at 9:52 PM Brett Cannon <brett@python.org> wrote:

That's what help() is for. The __repr__ is meant to help during development with some succinct representation of the object (hence why they typically have an identifier to help tell equal objects apart). Including docstrings and such is not a goal for the repr and would make it no longer succinct.

This means we have a __repr__ option in packages (Without Steven's snippet above)? 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/EIS67LTCZOXC475DKN323NA4XVKMFCCB/
Code of Conduct: http://python.org/psf/codeofconduct/