I have a python package named a with two files in it __init__.py and b .
a/ a/__init__.py a/b.py
File Contents:
and
When I import a into Python, why can I use ab directly? I am confused because I did not import b explicitly into a/__init__.py .
If I use empty a/__init__.py , then there is no b in the namespace a . So it seems that from .b import * (or from .b import c ) also imports b , why?
I checked the Python document and a few posts in SO, but did not find any related problems.
I want all things from b , but not b myself in a , then I could change a/__init__.py to
It's good?
source share