On 3/3/21 12:55 PM, George Harding wrote:

Python has an __all__ variable that can be defined in a module to restrict
which members of the module should be included in a call `from foo import *`.

The primary purpose these days for `__all__` is to codify a module's API.  The 
*-import is just a happy accident.

However specifying which members of the module should be excluded is more
difficult.

And unnecessary -- specify `__all__` so your users know which classes, 
functions, variables, etc., can be safely used.  If it should be excluded, 
don't put it in `__all__`.

--
~Ethan~
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/EPNXFKCBYTCQVEWLZZGLR2XUKXXVJEQC/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to