Author martin.panter
Recipients martin.panter
Date 2014-08-22.02:42:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1408675368.08.0.766854982306.issue22247@psf.upfronthosting.co.za>
In-reply-to
Content
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__
History
Date User Action Args
2014-08-22 02:42:48martin.pantersetrecipients: + martin.panter
2014-08-22 02:42:48martin.pantersetmessageid: <1408675368.08.0.766854982306.issue22247@psf.upfronthosting.co.za>
2014-08-22 02:42:48martin.panterlinkissue22247 messages
2014-08-22 02:42:47martin.pantercreate