[SciPy-user] help and lazy-import (?)

Pearu Peterson pearu at scipy.org
Fri Feb 27 05:08:01 CST 2004



On Fri, 27 Feb 2004, Arnd Baecker wrote:

> there there seems to be something weird
> going on when trying to access help in the following way
> 
> >>> import scipy
> >>> help("scipy.linalg")
> Help on instance of _ModuleLoader in scipy:
> 
> scipy.linalg = <module 'scipy.linalg' from '/opt/python/lib/pyt...
> e-packages/scipy/linalg/__init__.pyc' [imported]>
> 
> Doing another
> >>> help("scipy.linalg")
> 
> one gets the expected help.
> 
> I'd guess that this somehow has to to with the lazy importer of scipy.
> But maybe there is a workaround?

I get similar behaviour when using ipython. But in a traditional
Python prompt

>>> import scipy
>>> help("scipy.linalg")

I get expected help. This is because ppimport redefines built-in help:

>>> help
Type help () for interactive help, or help (object) for help about object.
>>> help.__module__
'scipy_base.ppimport'

So, for some reasons, in my case when using ipython, redefined help is 
not effective and probably because help is referenced in ipython before 
importing scipy. It seems that you are not using ipython, so, what is the 
contents of your PYTHONSTARTUP?

Pearu



More information about the SciPy-user mailing list