Message225637
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__ |
|
Date |
User |
Action |
Args |
2014-08-22 02:42:48 | martin.panter | set | recipients:
+ martin.panter |
2014-08-22 02:42:48 | martin.panter | set | messageid: <1408675368.08.0.766854982306.issue22247@psf.upfronthosting.co.za> |
2014-08-22 02:42:48 | martin.panter | link | issue22247 messages |
2014-08-22 02:42:47 | martin.panter | create | |
|