and why?
Sometimes I need import all the attributes of a module so I use wildcard importing, but one of my Vim scripts(using flake8 as its syntax checker) always gives me an warning and tell me unable to detect undefined names.
Is there any other disadvantages of using wildcard importing?
It’s generally not a good idea to use
from module import *. Wildcard importing leads to namespace pollution; you imported more names than you need and if you accidentally refer to an imported name you may not get the NameError you wanted.Also, if a future version of the library added additional names, you could end up masking other names, leading to stranger bugs still:
If you upgrade
spamand it now includes aspam.barit’ll replace thefoo.barimport in the line above.