This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Rolf Campbell
Recipients Rolf Campbell, brett.cannon, eric.snow, ncoghlan, r.david.murray
Date 2018-05-23.12:06:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527077190.12.0.682650639539.issue33547@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-05-23 12:06:30Rolf Campbellsetrecipients: + Rolf Campbell, brett.cannon, ncoghlan, r.david.murray, eric.snow
2018-05-23 12:06:30Rolf Campbellsetmessageid: <1527077190.12.0.682650639539.issue33547@psf.upfronthosting.co.za>
2018-05-23 12:06:30Rolf Campbelllinkissue33547 messages
2018-05-23 12:06:30Rolf Campbellcreate