Issue 22247: More incomplete module.all lists (original) (raw)

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: