How can you prevent specific functions or classes from being imported when the wildcard * is used with import?

  • Define all
  • Use a custom import
  • Use a hidden prefix
  • Use the @noimport decorator
You can prevent specific functions or classes from being imported when the wildcard * is used by defining a special variable named all in the module. all is a list of strings containing the names of symbols that should be imported when using from module import *.
Add your answer
Loading...

Leave a comment

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