proteus
proteus copied to clipboard
Refactor import statements
This is a truly horrible task but it really needs to be dealt with.
In general it is not a great idea to use from xxx import *
inside a module. On several occasions these import statements have created some peculiar and difficult to find bugs in my code and often the only solution is very hacky.
Thus, at some point, outside of things like python notebooks, I think we should move towards eliminating import *
statements.
Yes, wildcard imports can cause a lot of confusion.. Another small detail (if we are refactoring import statements) is that submodules of proteus that use other submodules should still use absolute imports, even if they are in the same folder.
from proteus import Context
from proteus.mprans import WaveTools
instead of just import Context
.
Or at least:
from . import Context
https://www.python.org/dev/peps/pep-0008/#imports