On Mon, Apr 27, 2020 at 07:58:54AM -0700, Ethan Furman 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?
Yes, it's annoying when English words can have two or more meanings. The first time I can across math.sin, I was very excited, until I realised it was just the trigonometric function :-( This is the gunslinger.draw versus the artist.draw problem. Unfortunately there can be a conflict between uniqueness and plain English, so unless we start naming our functions using GUIDs instead of words, we're always going to have to deal with it. from 123e4567_e89b_12d3_a456_426655440000 import \ 3a738970_fb72_83c1_a801_93210e19f013 *wink* In the builtins, `range` returns a iterable sequence of integers, it is not the statistical `range` function. `ord` stands for "ordinal", not "order" or "ordinary". `map` doesn't return a geographical map. And somehow we managed to cope. -- Steven