[issue33547] Relative imports do not replace local variables

2018-05-24 Thread Rolf Campbell
Rolf Campbell <thats.unpossi...@gmail.com> added the comment: Is there any way to use relative imports and explicitly request a sub-module? >From PEP 328: "import <> is always absolute" So it sounds like there is no way to duplicate the explicit request for a sub-m

[issue33547] Relative imports do not replace local variables

2018-05-23 Thread Rolf Campbell
Rolf Campbell <thats.unpossi...@gmail.com> added the comment: 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:

[issue33547] Relative imports do not replace local variables

2018-05-18 Thread Rolf Campbell
Rolf Campbell <thats.unpossi...@gmail.com> added the comment: OK, OK, I think I finally understand what you mean here. Let me try to repeat it just to make sure I really understand: When requesting a member of a multi-file module (like "func" in my example), python on

[issue33547] Relative imports do not replace local variables

2018-05-18 Thread Rolf Campbell
Change by Rolf Campbell <thats.unpossi...@gmail.com>: -- resolution: not a bug -> ___ Python tracker <rep...@bugs.python.org> <https://bugs.pyt

[issue33547] Relative imports do not replace local variables

2018-05-18 Thread Rolf Campbell
Rolf Campbell <thats.unpossi...@gmail.com> 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 i

[issue33547] Relative imports do not replace local variables

2018-05-17 Thread Rolf Campbell
Rolf Campbell <thats.unpossi...@gmail.com> added the comment: Thanks David, I agree that my assumption that the local valiables were not being replaced is not really what was going on there. I also agree that, while this might not strictly classify as a bug, it's probably not the most h

[issue33547] Relative imports do not replace local variables

2018-05-16 Thread Rolf Campbell
Rolf Campbell <thats.unpossi...@gmail.com> added the comment: Under simple circumstances, this is only reproducible when either directly in an interactive Python session (or as -c), but I encountered this type of problem in a much more complicated project which was NOT running a

[issue33547] Relative imports do not replace local variables

2018-05-16 Thread Rolf Campbell
New submission from Rolf Campbell <thats.unpossi...@gmail.com>: Relative imports do not replace local variables, but also don't fail. This can cause some very strange outcomes like this simple example: touch a.py; python3.6 -c 'a=7; b=5; from . import a as b; print(a,b)' I would