[SciPy-user] help and lazy importer (again or still ?)

Arnd Baecker arnd.baecker at web.de
Wed May 5 16:04:53 CDT 2004


On Wed, 5 May 2004, Pearu Peterson wrote:

[...]

> Luckily;-), it wasn't a bug but an overlooked case (I believe it was
> the last one). The corresponding support code is commited to CVS now.

Great - many thanks!

> > And there is another (related?) one:
> >
> > Python 2.3.3 (#1, May  3 2004, 16:38:25)
> > [GCC 3.3.3 (Debian)] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> help("scipy.linalg")
> > Gives
> >   Help on instance of _ModuleLoader in scipy:
> >   scipy.linalg = <module 'scipy.linalg' from '/home/python/PYTHON...
> >     e-packages/scipy/linalg/__init__.pyc' [imported]>
> >
> > Only on the second call to help("scipy.linalg")
> > one gets the expected documentation.
>
> Unfortunately, the only way to avoid the above issue is to import
> scipy_base or scipy (that imports ppimport module which adds a hook to
> pydoc.help to handle postponed modules) before trying to get help of scipy
> objects. You can import scipy_base in $PYTHONSTARTUP script, for instance.

Well, there is always a price to pay at some point ;-)
Still I am wondering why
  help("scipy.integrate.odeint")
works at a bare python prompt, whereas
  help("scipy.integrate")
doesn't. The latter seems simpler.
I am not sure if I should be able to understand this
behavior (somehow I think that in the first case it
has to look at scipy.integrate first and then at what
is in there.  The first "look" at scipy.integrate basically adds the
hook to pydoc.help so that the odeint documentation can be displayed -
but this is just guessing ;-).

Just one last question on this, and I will really shut up:
are there any implications/problems for doc-string extracting
tools (pydoc, epydoc and such)?
I'd guess not has they have to look at scipy first
and then the hook should be installed.

Best, Arnd



More information about the SciPy-user mailing list