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 <[email protected]>
<http://bugs.python.org/issue22247>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com