In Python, what exactly does import *
import? Does it import __init__.py
found in the containing folder?
For example, is it necessary to de
Here is a nice way to see what star / asterisk ( * ) has imported from a module:
before = dir()
from math import *
after = dir()
print(set(after) - set(before))
returns:
{'modf', 'pow', 'erfc', 'copysign', 'sqrt', 'atan2', 'e', 'tanh', 'pi', 'factorial', 'cosh', 'expm1', 'cos', 'fmod', 'frexp', 'log', 'acosh', 'sinh', 'floor', 'isclose', 'lgamma', 'ceil', 'gcd', 'ldexp', 'hypot', 'radians', 'atan', 'isnan', 'atanh', 'before', 'isinf', 'fabs', 'isfinite', 'log10', 'nan', 'tau', 'acos', 'gamma', 'asin', 'log2', 'tan', 'degrees', 'asinh', 'erf', 'fsum', 'inf', 'exp', 'sin', 'trunc', 'log1p'}
I was working with my own module, importing everything explicitly but the list of stuff to import was getting too long. So, had to use this method to get a list of what * had imported.