What is the difference between import module and from module import * in terms of namespace pollution?

  • Both have the same impact
  • from module import * is risky
  • from module import * is safer
  • import module is safer
Using from module import * pollutes the current namespace by bringing all symbols from the module into the current scope. This can lead to name clashes and make the code less maintainable. Importing module directly doesn't introduce symbols to the current namespace.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *