[SciPy-User] [SciPy-user] Convention and preferred practice when importing scipy

omnyx ognjen.i at gmail.com
Mon Oct 11 14:54:36 EDT 2010


You're right - I see that some of the functions are actually numpy functions.
So, is there a difference between just importing scipy (import scipy) or
just numpy (import numpy), except for the scipy.special subpackage package
that also come with scipy (that you mentioned).
And which is preferred?

thanks for the explanation!



Robert Kern-2 wrote:
> 
> On Mon, Oct 11, 2010 at 13:35, omnyx <ognjen.i at gmail.com> wrote:
>>
>> Upon reading
>> http://www.scipy.org/Getting_Started#head-eefd39e27392d16c48eb5350bc05b4b7045ffcd9
>>
>> is it then true that using
>> import scipy as sc
>> is as fast as
>> import numpy as np ?
>> (sc,np just shortcut names)
>>
>> I only need a couple of scipy built-in functions but too many to actually
>> list them all, and not all are part of numpy. I know I should be avoiding
>> from scipy import *
> 
> Which functions? A few from the scipy.special subpackage? "import
> scipy" really imports nothing other than numpy under a different
> namespace and with some different defaults exposed (for various
> historical reasons). You almost never want to do that. If you need
> things from one of the subpackages, you will need to import those
> subpackages explicitly, e.g. "from scipy import special". That will
> take a little more time than importing just numpy, but not as much
> time as it would to import from all of the subpackages one by one.
> 
> -- 
> 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
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
> 
> 

-- 
View this message in context: http://old.nabble.com/Convention-and-preferred-practice-when-importing-scipy-tp29936740p29936879.html
Sent from the Scipy-User mailing list archive at Nabble.com.




More information about the SciPy-User mailing list