What is `__all__` used for in a Python module?

Python Professional Hard

Python Professional — Hard

What is `__all__` used for in a Python module?

Key points

  • `__all__` determines what is exported with `from module import *`
  • It helps in managing the visibility of module attributes
  • This feature is particularly useful for controlling namespace pollution

Ready to go further?

Related questions