On 04/27/2020 05:09 AM, Steven D'Aprano wrote:
On Sun, Apr 26, 2020 at 07:48:10PM -0700, Ethan Furman wrote:
How many beginners know they want to call a function only once?
More than the number who know about LRU caches.
Ethan, are you objecting to a self-descriptive name because it is too
confusing for beginners and lru_cache isn't? Because that's the argument
you seem to be defending.
I'm objecting to using "beginners" as the basis for name choices for advanced
topics.
Aside from that, `once` is a fine name. I'm sure it means that a function can
only be defined once, and subsequent definitions will either be ignored or
raise, right?
>>> @once
... def my_unique_function(...):
... do_something_cool()
...
>>> def something_else():
... pass
...
>>> def my_unique_function(...):
... # uh oh, duplicate!
...
RuntimeError - duplicate function name detected
--
~Ethan~
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/VD7ZSMAGG2BHDAFJ2M7GME2TIPFA25C7/
Code of Conduct: http://python.org/psf/codeofconduct/