[IPython-dev] oinspect overrideable?
Sat Sep 8 19:58:02 CDT 2012
Sage overrides IPython's inspect modules in order to support Sage's
(admittedly weird) directory structure (a throwback to early Cython
days, IIRC). Anyways, in Sage's current pass to use the new IPython, I
see this comment:
# Ideally, these would just be methods of the Inspector class
# that we could override; however, IPython looks them up in
# the global :class:`IPython.core.oinspect` module namespace.
# Thus, we have to monkey-patch.
import sagedoc, sageinspect, IPython.core.oinspect
IPython.core.oinspect.getdoc = sageinspect.sage_getdoc
IPython.core.oinspect.getsource = sagedoc.my_getsource
IPython.core.oinspect.getargspec = sageinspect.sage_getargspec
I searched for each of these functions, and it does seem that they are
being imported and used directly. Would it be easy to convert those
calls to calls on a current inspector object so that these functions
would be easy to override?
More information about the IPython-dev