[New-bugs-announce] [issue22247] More incomplete module.__all__ lists

Martin Panter report at bugs.python.org
Fri Aug 22 04:42:48 CEST 2014


New submission from Martin Panter:

The nntplib.NNTPError exception is documented, but missing from __all__. I ran across another one the other day, but I can’t remember what it was now.

Is there a practical way to automatically test for some of these, perhaps by scanning the documentation for function and class definitions? These sort of bugs keep popping up, as people adding new features, exceptions, etc, forget to append them to __all__.

Another more radical idea: a decorator something like this might avoid copy-paste errors and make unexported APIs stand out more:

def public(api):
    sys.modules[api.__module__].__all__.append(api.__name__)
    return api

__all__ = list()
@public
def public_function(): ...
@public
class PublicClass: ...

Related:
* Issue 18554: os.__all__
* Issue 22191: warnings.__all__

----------
components: Library (Lib)
messages: 225637
nosy: vadmium
priority: normal
severity: normal
status: open
title: More incomplete module.__all__ lists
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22247>
_______________________________________


More information about the New-bugs-announce mailing list