You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
2to3 import fixer writes dotted_as_names into import_as_names #66615
When dealing with implicit relative imports of the form "import <dotted_as_names> as...", the 2to3 import fixer will rewrite them as "from . import <dotted_as_names> as...".
Activity
simonmweber commentedon Sep 16, 2014
When dealing with implicit relative imports of the form "import <dotted_as_names> as...", the 2to3 import fixer will rewrite them as "from . import <dotted_as_names> as...".
This is invalid syntax. Here's an example:
$ tree package/ package/ ├── __init__.py ├── rootmod.py └── subpackage ├── __init__.py └── mod.py1 directory, 4 files
$ cat package/rootmod.py # this is the only nonempty file import subpackage.mod as my_name $ python package/rootmod.pyProbably the easiest way to rewrite this is "from .subpackage import mod as my_name".