PEP 844: `public` and `private` builtins

So much bikeshedding about the type of __all__. :frowning:

Why don’t we silently deprecate __all__ that’s not a list, supporting it forever, but documenting it as frowned upon.

Then @public can issue a non-silent deprecation warning if it finds an existing __all__ that isn’t a list, and silently do nothing. This won’t break any existing code, because no existing code is currently using the proposed built-in version of @public.

Type checkers and/or linters may also warn when they see __all__ is not a list.


Separately, I still don’t see the point of @private, and I doubly don’t see why it should try to remove the name from __all__. Having the same name declared both public and private is obviously a mistake (dynamic shenanigans notwithstanding) and should be flagged rather than silently doing something random.

9 Likes