When an import statement in the pattern of from MODULE import * is used it may become difficult for a Python validator to detect undefined names in the program that imported the module. Furthermore, as a general best practice, import statements should be as specific as possible and should only import what they need.
from MODULE import *
The following code imports everything from the math built-in Python module.
# wildcard import = bad
from math import *
The import statement should be refactored to be more specific about what functions or variables it is using from the math module. The modified code below specifies exactly which module member it is using, which happens to be ceil in this example.
from math import ceil
There are some cases where making the import statement specific is not a good solution:
In these cases, use one of these idioms:
x = math.ceil(y)
import multiprocessing as mp
pool = mp.pool(8)