[SciPy-user] Right way to import scipy

Bill Baxter wbaxter at gmail.com
Mon Feb 20 22:25:18 CST 2006


On 2/21/06, Robert Kern <robert.kern at gmail.com> wrote:
>
> Bill Baxter wrote:
> > Is this a bug?  I would like to add info about getting at these
> > functions to the Scipy for Matlab Users wiki page, but I'd like to know
> > first if
> > A) this is the expected behavior, or just a bug and
>
> It's expected if you know what's going on, but not really desirable.
> scipy/__init__.py does a "from numpy import *" which is pulling in the
> linalg
> package. I'm pretty sure we don't want that. In fact, we already have a
> "del
> lib" statement to clear that conflicting module, so we should just add a
> "del
> linalg" statement, too.



Thanks for the explanation.


> B) if these import statements are really the best way to get at
> > scipy.linalg.lu <http://scipy.linalg.lu> et al.
> >    import numpy as N
> >    import scipy as S
> >    from scipy.linalg import lu
>
> Yup. Or just:
>
>   from scipy.linalg import lu
>   lu(A)
>
> or even:
>
>   from scipy import linalg
>   linalg.lu(A)



That last one doesn't work:

[starting from a clean environment[
>>> from scipy import linalg
>>> linalg.lu
Traceback (most recent call last):
  File "<input>", line 1, in ?
AttributeError: 'module' object has no attribute 'lu'
>>> from scipy import version
>>> version.version
'0.4.6'


--Bill Baxter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20060221/55acc7e1/attachment.htm


More information about the SciPy-user mailing list