python - Difference between import numpy and import numpy as np -


i understand when possible 1 should use

import numpy np 

this helps keep away conflict due namespaces. have noticed while command below works

import numpy.f2py myf2py 

the following not

import numpy np np.f2py #throws no module named f2py 

can please explain this?

numpy top package name, , doing import numpy doesn't import submodule numpy.f2py.

when import numpy creats link points numpy, numpy not further linked f2py. link established when import numpy.f2py

in above code:

import numpy np # np alias pointing numpy, @ point numpy not linked numpy.f2py import numpy.f2py myf2py # command makes numpy link numpy.f2py. myf2py alias pointing numpy.f2py 

here difference between import numpy.f2py , import numpy.f2py myf2py:

  • import numpy.f2py
    • put numpy local symbol table(pointing numpy), , numpy linked numpy.f2py
    • both numpy , numpy.f2py accessible
  • import numpy.f2py myf2py
    • put my2py local symbol table(pointing numpy.f2py)
    • its parent numpy not added local symbol table. therefore can not access numpy directly

Comments

Popular posts from this blog

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

objective c - Greedy NSProgressIndicator Allocation -

how to set an OCR language in Google Drive -