I observed an unexcepted(imo) behaviour in python2.7. Program structure looks like this:
run.py
package/
__init__.py
a.py
b.py
run.py:
from package import *
init.py:
from package.a import *
Consider now a.py
and b.py
as empty files.
In my opinion, this program should fail due circural import. Why? Because when we import package
init
file has an absolute import which indicates to access same init
file while importing.
To see excepted by me situation just add to a.py
this:
from package.b import *
In result we receive an ImportError.
It is a bug, or excepted behaviour? I can't find any information in docs, about special treated absolute imports in init files?