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~
_______________________________________________
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/ZFZLRGKXMBTW6ZH27XTMNE335KCZWMDY/

Reply via email to