On 04/26/2020 05:11 PM, Steven D'Aprano wrote:
On Sun, Apr 26, 2020 at 06:43:06PM +0200, Alex Hall wrote:
It's not clear to me why people prefer an extra function which would be
exactly equivalent to lru_cache in the expected use case (i.e. decorating a
function without arguments). It seems like a good way to cause confusion,
especially for beginners. Based on the Zen, there should be one obvious way
to do it.
Indeed, and if you want to guarantee that a function is executed exactly
*once*, then a decorator called *once* is that Obvious Way.
How many beginners do you know who even know what a LRU cache is?
How many beginners know they want to call a function only once?
--
~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/KHMEWONMCG2TNJF7332RPWAX7R4LHRM2/
Code of Conduct: http://python.org/psf/codeofconduct/