Brett Cannon added the comment:

So the problem is that you doing `from .a import test` and not `from . import 
a; test = a.test`. Whenever you do `from X import Y`, import actually imports 
X. Since X wasn't in sys.modules, it performs a proper import which means it 
sets the attribute on the package accordingly. But had Y been what you were 
after, then import simply looks for the Y attribute on the package instead of 
doing a full import.

IOW everything is working as expected (and I still wish people weren't allowed 
to import objects out of modules directly).

----------
resolution:  -> not a bug
status: open -> closed

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

Reply via email to