Search code examples
pythonimportmodulereadability

How do I read code where "from <module> import *" is used?


Suppose I read code written by someone else where "from import *" is used, how can I determine what module a function is from? Is this the reason why some people frown upon "from import *"?


Solution

  • Yes, this is why from <module> import * is considered bad style. What you can do is remove these * imports one by one, then check which NameErrors you get and solve them one by one by explicit imports.