Message317390
OK, while I understand what you are saying, that is NOT how absolute imports work. I'll give an example:
./main.py:import func
./main.py:print(f"Value of func.func after import func:{func.func}")
./main.py:import func.func
./main.py:print(f"Value of func.func after import func.func:{func.func}")
./func/__init__.py:func = 1
./func/__init__.py:from . import func
./func/__init__.py:print(f"Value of func after from . import func:{func}")
./func/func.py:print("Module imported")
Here, the relative import inside __init__.py does NOT load the "func.py" module because there is already an object called "func".
But, the absolute "import func.func" does load "func.py" even though there is already a "func.func" object.
Are these supposed to work differently? That seems strange to me. |
|
Date |
User |
Action |
Args |
2018-05-23 12:06:30 | Rolf Campbell | set | recipients:
+ Rolf Campbell, brett.cannon, ncoghlan, r.david.murray, eric.snow |
2018-05-23 12:06:30 | Rolf Campbell | set | messageid: <1527077190.12.0.682650639539.issue33547@psf.upfronthosting.co.za> |
2018-05-23 12:06:30 | Rolf Campbell | link | issue33547 messages |
2018-05-23 12:06:30 | Rolf Campbell | create | |
|