[IPython-user] scipy delayed importer and ?

Arnd Baecker arnd.baecker at web.de
Tue Nov 2 14:02:32 CST 2004


Hi,

I would like to bring up an issue which we discussed some while ago.
Last week-end I gave a workshop on Python at the Linuxtag.
When showing how to get information on specific commands
one person immediately stumbled across the following


Python 2.3.4 (#2, Sep 24 2004, 08:39:09)
Type "copyright", "credits" or "license" for more information.

IPython 0.6.3 -- An enhanced Interactive Python.
?       -> Introduction to IPython's features.
@magic  -> Information about IPython's 'magic' @ functions.
help    -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: import scipy
In [2]: scipy?
In [3]: scipy.optimize?
Type:           instance
Base Class:     scipy_base.ppimport._ModuleLoader
String Form:    <module 'scipy.optimize' from
'/usr/lib/python2.3/site-packages/scipy/optimize/__init__.py' [import
postponed]>
Namespace:      Interactive
File:
/usr/lib/python2.3/site-packages/scipy/optimize/__init__.py

In [4]: scipy.optimize?
In [5]:

Only the second time (In [4]) you get the desired help

So his first reaction was that there is no further documentation
on this.

I think it would be great if there was a solution to this...

Best,

Arnd

P.S.: the same type of problem also occurs with pressing TAB:
  In [3]: scipy.optimize.<TAB>
Here one has to press TAB twice to get the full list of

PPS: On the technical side: could one maybe check
if scipy.optimize.__str__() contains "postponed" and
trigger the lazy importer to really import before the TAB and help is
given ?




More information about the IPython-user mailing list