On 27 Apr 2020, at 16:01, Ethan Furman <ethan@stoneleaf.us> wrote:
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
That needs a linter to spot ai think. Or are you saying that once could be interested to mean I cannot do that 2nd def? Barry
-- ~Ethan~ _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/VD7ZSM... Code of Conduct: http://python.org/psf/codeofconduct/