Message291414
> 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. |
|
Date |
User |
Action |
Args |
2017-04-10 05:58:03 | Victor.Varvariuc | set | recipients:
+ Victor.Varvariuc, gvanrossum, barry, brett.cannon, ncoghlan, THRlWiTi, eric.snow |
2017-04-10 05:58:03 | Victor.Varvariuc | set | messageid: <1491803883.71.0.63579709208.issue30024@psf.upfronthosting.co.za> |
2017-04-10 05:58:03 | Victor.Varvariuc | link | issue30024 messages |
2017-04-10 05:58:03 | Victor.Varvariuc | create | |
|