[issue33826] enable discovery of class source code in IPython interactively defined classes

Thomas Viehmann report at bugs.python.org
Fri Jun 15 15:46:16 EDT 2018


Thomas Viehmann <tv.python.org at beamnet.de> added the comment:

Apologies for not being clear.
So I wrote:

In IPython (or Jupyter), `inspect.getsource` is able to retrieve the source code for functions but not classes.

By this I mean:

import inspect

class X:
  pass

inspect.getsource(X)

Note that:
- it won't work in the vanilla python interpreter,
- it does work for functions in Jupyter/IPython currently,
- it works for classes (and functions) in modules.
What I would like is to have it work for classes in Jupyter/IPython.

By the way: Would a PR be more convenient than a patch?

----------

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


More information about the Python-bugs-list mailing list