
Joshua D. answered 06/02/20
Computer Science and Machine Learning Course Tutor
Hello! The expression "__all__" deals with modules and how a file gets imported by other files. It has a twofold purpose:
- It gives the user of the file information about the code - the the references contained within __all__ are publicly available, that they are intended to be used and that they should not change during execution.
- When importing a file as a module, __all__ defines which references should be imported when using the wildcard import, or import *.
Generally speaking, the practice of using __all__ is designed to make understanding and using a Python module easier.
An excellent reference if you are looking to explore __all__ further might be: https://stackoverflow.com/questions/44834/can-someone-explain-all-in-python, the third response from the top provides the most accurate and detailed response to this question.
I hope you find this helpful!