R. David Murray <rdmur...@bitdance.com> added the comment:

It's importing 'a' from '.', which I guess in this context means from the 
current namespace (__main__), and a is 7.  You'll note that 'b' did get 
repointed, but it got repointed to what 'a' points to, instead of to 5.  If it 
really wasn't replacing the local, you'd get '7 5', not '7 7'.

So, this is weird but expected, I think.  You'll have to actually produce the 
example that doesn't involve __main__ if you want us to look in to that, but 
most likely it will be some similar phenomenon.

I'm not 100% sure this is the *desired* behavior of 'from . import', though, so 
I'm leaving this open for the import experts to look at.

Also, in 3.8 at least I get a warning from the import system, which is a clue 
something weird is going on :)

----------
nosy: +brett.cannon, eric.snow, ncoghlan, r.david.murray

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33547>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to