__all__ Explained

Tagged: ,

This topic was published by and viewed 819 times since "". The last page revision was "".

Viewing 1 post (of 1 total)
  • Author
  • DevynCJohnson
    • Topics - 443
    • @devyncjohnson

    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__ = [

    See http://dcjtech.info/topic/pybooster/ which is a collection of Python libraries that use "__all__".

    Further Reading

Viewing 1 post (of 1 total)