
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