On 22Jul2019 2051, Kyle Stanley wrote:
Also, is the rule  "unless explicitly documented public, all
imports are private even if not prefixed with an underscore" officially stated 
anywhere, or is it mostly implied? Personally, I think that it should be explicitly 
stated in a public manner if it's the methodology being followed.

I'm not sure if it is, which probably means it isn't. But I agree this should be the rule as it implicitly gives us the minimal public API upon definition and it is very easy to add in anything else that ought to have been there.

A solid alternative proposal would also be Barry's public decorator proposal: 
https://public.readthedocs.io/en/latest/. I remember him saying that it was 
largely rejected by the community when it was proposed, but I'm not certain as 
to why. It would be far easier to implement something like this than it would 
be to rename all of the non-public functions.

The @public decorator is basically:

def public(fn):
    __all__.append(fn.__name__)
    return fn

It's trivial, but it adds a runtime overhead that is also trivially avoided by putting the name in __all__ manually. And once it's public API, we shouldn't be making it too easy to rename the function anyway ;)

Cheers,
Steve
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/Z32PBAL2ORI7GDVC4HECURKUI4REA6B7/

Reply via email to