python - Hierarchy in Packages -


i'm doing simulations of optical properties , started create package own use includes functions , object have written far. obvious reasons use numpy , used import numpy in modules.

now, package, wish make numpy globally available every submodule. i've gathered far, might bad practice. however, if import numpy in each module numpy key/function module, seems worse practice.

in other words: when create minimal package package/__init __.py , package/module.py , import numpy in module.py, import , print available functions

import package print package.module.__dict__.keys() ['__builtins__', '__file__', '__package__', 'numpy', '__name__', '__doc__'] 

numpy shows up. in principle access numpy via

package.module.numpy 

i not sure if problem , how done correctly.

i agree @sneftel's comment -- isn't problem.

since not part of documented interface of module, although user can see there something named numpy in module (which not numpy module, anything), grownup, user should avoid using it.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -