Rolf Campbell <[email protected]> added the comment:
Re-opening because I've found a simple example that does not involve __main__.
./func/__init__.py:func = 1
./func/__init__.py:from . import func
./func/__init__.py:print(f"Namespace value of func after func module
import:{func}")
./func/func.py:print("Module imported")
./main.py:import func
./main.py:def func(x):
./main.py: return x
If you create files that look like that, and then run: "python3.6 main.py" I
get this output:
Namespace value of func after func module import:1
If I comment out the "func = 1" line, then func ends up being imported (and
printing as a <module...>).
----------
status: closed -> open
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com