On Wed, 3 Mar 2021 at 23:59, Brendan Barnwell <brenb...@brenbarn.net> wrote:
>  But usually you want to define it at the beginning as a sort of
> documentation aid ("this is the public API").

This is a little off-topic, but I'm curious, since usually, for public
functions and classes, I do

__all__ = (Class.__name__, func.__name__, ...)

So I have to put it at the end of the module. I do this because if I
change the class or function name and I forget to change it in
__all__, I get an exception.

Furthermore, if there's a module composed by submodules, I usually do

from .a import *
from .b import *

__all__ = a.__all__ + b.__all__

In your opinion, these are good or bad practices?
_______________________________________________
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/AZLCRXYWZUS63RDSAUEQ52SGRXGKY3KE/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to