Imagine the following scenario:
A.py:
from B import func_b()
def func_a():
print("rofl" + func_b())
B.py:
def func_b():
print("copter")
main.py:
import A
A.func_a()
A.func_b()
Here main.py
uses func_b
via A's import
of it. Note that A.py
doesn't intentionally export the name via __all__
, it simply exposes it as a consequence of how Python's namespaces work.
Subjectively, a lot of styleguides recommend not accessing func_b
via A
, but instead importing B
directly and then using B.func_b
, due to the increased coupling and violating the principle of data encapsulation.
Q: Is there an official name for this manner of round-a-bout importing?