-
-
Notifications
You must be signed in to change notification settings - Fork 612
Closed
Labels
bugSomething isn't workingSomething isn't working
Milestone
Description
#1107 introduced a rewrite of import test.module as m styled imports to something like from test import module as m.
These changes are actually not equivalent (even though the name clash probably indicates poor design): using the standard import machinery, import test.module always tries to import the module test/module.py from somewhere on sys.path while from test import module will take anything it can get.
Consider a package like
$ tree test
test
├── __init__.py
└── module.py
0 directories, 2 files
$ cat test/__init__.py
def module():
pass
with that, we can see the difference:
$ python -c 'import test.module as m; print(m)'
<module 'test.module' from '.../test/module.py'>
$ python -c 'from test import module as m; print(m)'
<function module at 0x7fb259fcf700>
which makes me a bit nervous since I usually don't look that deep into the code of dependencies.
Is there a setting to disable the rewrite?
penguinolog, max-sixty, LouisTrezzini and blisc
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working