[IPython-dev] oinspect overrideable?
Jason Grout
jason-sage at creativetrax.com
Sat Sep 8 20:58:02 EDT 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
#sagedoc.my_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?
Thanks,
Jason
More information about the IPython-dev
mailing list