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

Arnd Baecker arnd.baecker at web.de
Tue Mar 2 09:49:05 CST 2004

Hi Pearu,

On Mon, 1 Mar 2004, Pearu Peterson wrote:


> I have fixed this issue in CVS using different and I think more robust
> approach: `import scipy_base` will redefine help.__class__.__call__ method
> to support ppimport'ed modules. Now `help` works as expected for all
> of the following usage cases:
>   help(scipy.linalg)
>   help("scipy.linalg")
>   exec 'help("scipy.linalg")'
>   etc
> I have tested this on Python 2.3.3 only though.

Great - _many_ thanks for the fix!
     >>> import scipy
     >>> help("scipy.xplt")
     In [1]: import scipy
     In [2]: help("scipy.xplt")
also work for me (I am also 2.3.3 as well).

There seems to be one case where I still see the module
loader when requesting help:

  Python 2.3.3 (#1, Feb  3 2004, 22:05:11)
  [GCC 3.2] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> help("scipy.linalg")

I.e., no `import scipy` (or similar) has been done before.
I am not sure how important this case is
(eg. for doc-extracting tools ?).

Concerning ipython:
  - for the help itself it seems to work
  - for TAB completion one (sometimes) has to press TAB twice,
    for example:

In [1]: import scipy
In [2]: scipy.xplt.               # pressing TAB here gives:
scipy.xplt.__class__           scipy.xplt.__name__
scipy.xplt.__doc__             scipy.xplt.__repr__
scipy.xplt.__file__            scipy.xplt.__setattr__
scipy.xplt.__getattr__         scipy.xplt.__str__
scipy.xplt.__init__            scipy.xplt._ppimport_importer
scipy.xplt.__module__          scipy.xplt.test
In [2]: scipy.xplt.              # pressing TAB here then gives the
                                 # full list (omitted here ;-)

I am not sure what to do here. Anyway, this is only
here for completeness and should better be discussed
on the ipython mailing list (I know, Fernando, you are
super-busy right now, so we will try to have a quick look at that



More information about the SciPy-user mailing list