On Sun, Apr 26, 2020 at 09:58:46PM -0400, Dan Sommers wrote:

> > How many beginners do you know who even know what a LRU cache is?
> 
> The same number of beginners who know to look in functools for a
> decorator called once?

Look in *functools* at all? Probably not that many.

Google for "how do I execute a function only once" rather than 
"lru_cache"? Many, many more.

I'm not opposed to jargon when it is appropriate. I don't want to change 
the name of the lru_cache! But if we have the opportunity for a functional 
enhancement, why wouldn't we prefer a name which is:

- plain English, not jargon
- memorable
- self-descriptive
- describes *what* you want to do rather than *how* you want to do it
- and matches the terminology used by other languages and libraries?

Possibly "run_once" is even more descriptive. It avoids the "run once 
versus define once" trap that Ethan mentioned, and is more accurate than 
the C++ name "call_once".

https://stackoverflow.com/questions/50904087/run-a-function-only-once-during-runtime-in-python



-- 
Steven
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/Q4TBYC3GKXRWISN5S7IIYZIOXH4U7YXZ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to