[SciPy-dev] Postponed imports and docstrings
arnd.baecker at web.de
Wed Nov 3 04:02:15 CST 2004
On Wed, 3 Nov 2004, Pearu Peterson wrote:
> On Tue, 2 Nov 2004, Fernando Perez wrote:
> >> Fernando, could you point out which part of ipython implements `?..`
> >> so that I could look into it and fix the in scipy_base/ppimport.py?
> > Sure, it's mostly done by the code in Magic.py, method _ofind around line
> > 228. When you type 'foo?', ipython really issues '%pinfo foo', which makes
> > a call to _ofind('foo') to pull out the object pointed to by the name 'foo',
> > along with some info about it. This is then passed to OInspect's pinfo()
> > method, which builds the full information page.
> > Note that I tried a bunch of tricks for a couple of hours, trying to repeat
> > the object detection inside _ofind() when scipy objects were involved, but I
> > failed to fix the problem. So unfortunately, I'll have to defer to you for a
> > proper solution. I was expecting that perhaps I could toss in a small hack
> > to solve this on the ipython side, but I can't seem to be able to replicate
> > with a simple change the behavior of a repeated 'foo?' call. This is
> > probably because I don't really understand the delayed import mechanism, and
> > in reality a proper fix in scipy is probably the right approach.
> Thanks for the tips. The fix to the problem was simpler: inspect.getdoc
> required a wrapper that applies ppresolve to its argument. Now ?optimize
> works also in first attempt.
Great - many thanks!!!
Does this also solve the problem when pressing <TAB> in IPython?
In : import scipy
In : scipy.optimize. # <TAB> pressed here
In : scipy.optimize. # pressing <TAB> the second time
So pressing <TAB> the second time gives the full list of options.
It would be nice if this worked as well.
Again, many thanks,
More information about the Scipy-dev