On Thu, Mar 4, 2021 at 9:57 AM Brendan Barnwell <brenb...@brenbarn.net> wrote:
>
> On 2021-03-03 14:06, Chris Angelico wrote:
> > You could implement that yourself:
> >
> > __all__ = {n for n in globals() if not n.startswith("_")} - __exclude_all__
>
>         Sort of.  That will only work if you define __all__ at the end of the
> file.  But usually you want to define it at the beginning as a sort of
> documentation aid ("this is the public API").

Given that it's meant to be program-readable, that shouldn't be too
big a deal. You can always put your human-readable public API
description in the docstring (where there's room for actual
descriptions, not just a list of names).

>         I do think something like __exclude_all__ would be handy.  It can be
> annoying to have to define __all__ just to exclude a few things.  But
> it's not a huge issue.

We are programmers. When there is a problem, we (should!) seek a
solution that involves getting the computer to do the work for us.

ChrisA
_______________________________________________
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/QVUXCOT2DBMWOVBD3S4UN5OXCQUT73U4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to