
July 23, 2019
11:20 a.m.
On 07/23/2019 08:44 AM, Steve Dower wrote:
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 ;)
The run-time overhead added by executing @public is trivially trivial. ;) But your argument about the too-easy change of a public API strikes home. I think a safer @public would be one that verifies the function is in `__all__` and raises if it is not. -- ~Ethan~