[Python-ideas] Avoid (was: Improve) circular import
Oleg Broytman
phd at phdru.name
Tue Apr 10 11:55:51 CEST 2012
Hi!
On Tue, Apr 10, 2012 at 12:30:34PM +0300, Victor Varvariuc <victor.varvariuc at gmail.com> wrote:
> Consider the following directory structure (Python 3):
>
> [test]
> main.py
> [tree]
> __init__.py # empty
> branch.py
> root.py
>
> branch.py:
>
> import tree
My opinion is - restructure code to avoid circular import instead of
hacking import machinery.
Why does a submodule import the entire package instead of importing
just root?
Oleg.
--
Oleg Broytman http://phdru.name/ phd at phdru.name
Programmers don't die, they just GOSUB without RETURN.
More information about the Python-ideas
mailing list