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
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:
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
Change by Rolf Campbell <thats.unpossi...@gmail.com>:
--
resolution: not a bug ->
___
Python tracker <rep...@bugs.python.org>
<https://bugs.pyt
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
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
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
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