I'd like to give my explicit +1 on this proposal, and for the
suggested alternative name "call_once". To me, this seems to be the
case of a common small startup optimization that's very easy to get
wrong, and to many users may be too much of a hassle to write their
own implementation to be worth using. Thus, it makes sense to include
something like this in the standard library.

The alternative name "call_once" will make it's purpose significantly
more clear. IMO, the parallel to a similar functionality in C++ is a
nice added bonus. Although we shouldn't restrict our APIs based on the
naming choice of other languages, it's very convenient for those who
are already familiar with the other one.

Also, I'm in agreement that the addition of this to functools is
similar enough to the existing members and small enough that it
shouldn't require a PEP. A bpo issue and PR should be sufficient, but
I would consider potentially cross-posting this to python-dev to get
additional attention from other core developers.

On Mon, Apr 27, 2020 at 3:25 PM Antoine Pitrou <solip...@pitrou.net> wrote:
>
>
> My own opinion is that it's limited enough in scope (and probably
> uncontroversial implementation-wise) that it doesn't need a PEP.  Of
> course other core developers may disagree, so perhaps wait a few days
> before submitting a PR :-)
>
> Regards
>
> Antoine.
>
>
> On Mon, 27 Apr 2020 20:16:53 +0100
> Tom Forbes <t...@tomforb.es> wrote:
> > I would think that would be a great name, it’s more explicit and fits more 
> > in with its siblings “lru_cache” and “cached_property”.
> >
> > Not to imply that there is a consensus to move forward, I would be 
> > interested in knowing what the next steps would be if there was. Would this 
> > require a PEP to be submitted? Or is it similar enough to existing 
> > functionality that it might not require one?
> >
> > > On 27 Apr 2020, at 19:37, Antoine Pitrou 
> > > <solipsis-xnda5wrcr86stnjn9+b...@public.gmane.org> wrote:
> > >
> > > On Mon, 27 Apr 2020 09:26:53 -0700
> > > Ethan Furman <et...@stoneleaf.us> wrote:
> > >>
> > >>> Or are you saying that once could be interpreted to mean I cannot do 
> > >>> that 2nd def?
> > >>
> > >> That is what I was saying -- that `once`, all by itself, could mean 
> > >> multiple things.
> > >
> > > That's a good point.  A more explicit spelling would be `@call_once`,
> > > what do you think?
> > >
> > > (that's also the C++ spelling, incidentally, but I suspect most
> > > beginners won't care about that ;-))
> > >
> > > Regards
> > >
> > > Antoine.
> > >
> > > _______________________________________________
> > > Python-ideas mailing list -- 
> > > python-ideas-+zn9apsxkcednm+yrof...@public.gmane.org
> > > To unsubscribe send an email to 
> > > python-ideas-leave-+zn9apsxkcednm+yrof...@public.gmane.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/NYOB46XXHLPDK3V7IPQL6IJ6FNE2ZK7S/
> > > Code of Conduct: http://python.org/psf/codeofconduct/
> >
>
>
> _______________________________________________
> 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/BJ7MPRTG7EL3LD4FUWG63XPRLCWEPQH7/
> Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________
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/BWICEGCLHTJRYOCWSP4VFPL6CMZZVFWO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to