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 Victor.Varvariuc
Recipients THRlWiTi, Victor.Varvariuc, barry, brett.cannon, eric.snow, gvanrossum, ncoghlan
Date 2017-04-10.05:58:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1491803883.71.0.63579709208.issue30024@psf.upfronthosting.co.za>
In-reply-to
Content
> it is possible for module a to override its attribute b without updating sys.modules

This sounds like a really strange application.

Even if someone overrides the attribute, when you do in other place `import a.b.c as m` you expect `a.b.c` to be path to a module, otherwise it would be hard to debug. 

The docs https://docs.python.org/3/reference/simple_stmts.html#import say `import_stmt     ::=  "import" module ["as" name]` meaning everywhere that `module` is a path to a module.

https://docs.python.org/3/reference/import.html#searching

> To begin the search, Python needs the fully qualified name of the module (or package, but for the purposes of this discussion, the difference is immaterial) being imported. This name may come from various arguments to the import statement, or from the parameters to the importlib.import_module() or __import__() functions.

So if you treat `import a.b.c as m` as `import a; m = a.b.c` -- it go go in some cases against the docs.
History
Date User Action Args
2017-04-10 05:58:03Victor.Varvariucsetrecipients: + Victor.Varvariuc, gvanrossum, barry, brett.cannon, ncoghlan, THRlWiTi, eric.snow
2017-04-10 05:58:03Victor.Varvariucsetmessageid: <1491803883.71.0.63579709208.issue30024@psf.upfronthosting.co.za>
2017-04-10 05:58:03Victor.Varvariuclinkissue30024 messages
2017-04-10 05:58:03Victor.Varvariuccreate