Chris Angelico writes:
 > On Sun, Dec 5, 2021 at 3:08 PM Stephen J. Turnbull
 > <stephenjturnb...@gmail.com> wrote:

 > > This one is Worth Doing Right the first time, I think.  And IMO David
 > > Mertz is right: doing it right means a more general deferred-evaluation
 > > object (not to be confused with Deferreds that need to be queried
 > > about their value).
 > 
 > If you think that deferred evaluation objects are the right way to do
 > it, then write up a proposal to compete with PEP 671.

That's not your call, I'm afraid.  "Keep the status quo" is always a
viable option, regardless of other options.  And other things equal,
it's the preferred option.

 > In my opinion, it is a completely independent idea,

You're welcome to your opinion, of course.  But if you want to claim
that's a reason for implementing your proposal, you need to support
it.  You also need to explain why the additional potential complexity
of a third kind of default argument (evaluated at definition,
evaluated during call, evaluated when referenced) isn't a big problem.

 > which is not a complete replacement for late-bound defaults;

Why not?  If we have such objects, we could simply specify that in the
case where such an object is specified as a function parameter
default, it is evaluated in the same environment as your late-bound
defaults.  So we can have your schsemantics if that's what we want.

On the other hand, it might turn out that 90% of the time, it doesn't
matter if it's evaluated as part of the calling process, 9% of the
time the natural place to evaluate it is at the point of first use,
and 1% of the time it should be evaluated before the function body
proper is entered.  In that case the late-bound default would be of
some utility, but is it worth it?  David's "infinitesimal utility"
argument seems likely to apply.

What else would such a deferred-evaluation object be unable to do that
your late-bound default can do?

 > we could continue to have neither.

That's where I am.  More than any of these issues, the lack of a well-
defined, properly introspectable object bothers me.  In 2021, we
should provide that.


_______________________________________________
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/5KA2FKOFWXAETELXR3SHOGB7657TTWPJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to