numpy - Python: universal import -
can explain 'import' universal, don't need write example:
from numpy import * import numpy import numpy np numpy.linalg import *
why not import numpy
or from numpy import *
incude "numpy"?
i'm not sure mean "all numpy", should never need use more 1 form of import
@ time. different things:
option one: import
import numpy
bring entire numpy module current namespace. can reference moudule numpy.dot
or numpy.linalg.eig
.
option two: from ... import *
from numpy import *
bring of public objects numpy current namespace local references. if package contains list named __all__
command import
every sub-module defined in list.
for numpy list includes 'linalg', 'fft', 'random', 'ctypeslib', 'ma', , 'doc' last checked. so, once you've run command, can call dot
or linalg.eig
without numpy prefix.
if you're looking import pull every symbol every submodule in package namespace, don't think there one. have this:
from numpy.linalg import * numpy.fft import * numpy.random import * numpy.ctypeslib import * numpy.ma import * numpy import *
which is, think, you're trying avoid.
Comments
Post a Comment