T.Crane wrote: > I'm new to python and I seem to get different behavior depending on... > well who knows what. Here's my question concerning importation of > packages/modules. > > I want to use scipy. So at the prompt (using iPython, installed with > Enthought edition on Windows XP) I type: > > ln [1]: from scipy import * > > Now, I know integrate is a package this is in scipy. I want to use > the ode class/module that's in integrate. So I type: > > ln [2]: from integrate import * > > And I'm told > > ImportError: No module named integrate > > In order to get access to the ode class, I end up having to type: > > ln [3]: from scipy.integrate import * > > Then it works. Will someone explain to me what I'm misunderstanding? > I don't understand why after importing everything in scipy (which > includes integrate), I was told there was no module named integrate. > What gives? I there are sevarl functions (modules) that I want to use > that are a few levels down from the root package, what's the most > economical method of importing them?
Everything Steve Holden said is correct. I'll just add that we do have a function that will load all of the subpackages. import scipy scipy.pkgload() from scipy import * We don't load all of the subpackages by default because we have a lot of extension modules that link to largish libraries. Loading all of them all of the time takes substantial amounts of time. Also, I don't recommend using either pkgload or "from scipy import *" in code. However, from the interactive prompt, feel free. That is precisely what these features were designed for. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco -- http://mail.python.org/mailman/listinfo/python-list