numpy numpy.lib And sometimes it doesn't: In [2]: import tornado tornado.gen Out[1]: <module 'numpy.lib' from '/home/bmerry/work/sdp/env3/lib/python3.5/site-packages/numpy/lib/__init__.py'> --------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-2-ac9fe21bb8d4> in <module>() 1 import tornado ----> 2 tornado.gen AttributeError: module 'tornado' has no attribute 'gen'
It's surprisingly complicated. But in simple terms: import foo.bar will 1. Load module foo (call it foo_module) 2. Load module foo.bar (call it foobar_module) 3. Do foo_module.bar = foobar_module 4. Do your_module.foo = foo
.h5datav1 import H5DataV1 from .h5datav2 import H5DataV2 from .h5datav3 import H5DataV3 ... # Clean up top-level namespace a bit del h5datav1, h5datav2, h5datav3