On Sat, Oct 30, 2021 at 06:52:33PM -0700, Christopher Barker wrote:

> The point is: clearly specifying what's required, what's optional, and what
> the defaults are if optional, is really, really useful -- and this PEP will
> add another very handy feature to that.

+1

Earlier I said that better help() is "icing on the cake". I like icing 
on my cake, and I think that having late-bound defaults clearly readable 
without any extra effort is a good thing. The status quo is that if you 
introspect a function's parameters, you will see the sentinel, not the 
actual default value, or the expression that gives the default value, 
that the body of the function actually uses.

    >>> inspect.signature(bisect.bisect_left)
    <Signature (a, x, lo=0, hi=None, *, key=None)>

I challenge anyone to honestly say that if that signature read:

    <Signature (a, x, lo=0, hi=len(a), *, key=None)>

they would not be able to infer the meaning, or that Python would be a 
worse language if the interpreter managed the evaluation of that default 
so you didn't have to.

And if you really want to manage the late evaluation of defaults 
yourself, you will still be able to.


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

Reply via email to