This topic was published by DevynCJohnson and viewed 732 times since "". The last page revision was "".
- Topics - 444
In Python, "__all__" is a special variable that is commonly used in libraries.
"__all__" should be near the top of a script before any imports are performed and before defining any classes, variables, or functions. When the library is imported, "__all__" acts like an index of importable objects within the library. In other words, this variable lists public objects. So, running "from LIBRARY import *" will only import the objects listed in the "__all__" variable.
__all__ = [ 'FUNCTION1', 'FUNCTION2', 'FUNCTION3', ]
See http://dcjtech.info/topic/pybooster/ which is a collection of Python libraries that use "__all__".
- What is __init__? - http://dcjtech.info/topic/what-is-__init__/