On Wed, Oct 27, 2021 at 4:51 AM David Mertz, Ph.D.
<david.me...@gmail.com> wrote:
>
> On Tue, Oct 26, 2021, 1:08 PM Chris Angelico <ros...@gmail.com> wrote:
>>
>> No, I agree. We have to still be able to introspect them.
>>
>> At the moment, when you look at a function's defaults, they are all values. 
>> With this change, some would be values and some would be markers saying that 
>> code would be executed.
>
>
> So why on earth NOT make these general "deferred" objects that can be used in 
> other contexts?!

Because they're NOT deferred objects. They're argument defaults. Consider:

def f(x=>print("Hello")):
    ...

When should that print happen? Argument defaults are processed before
the function body begins, so you can be confident that it has happened
before the first line of actual code. But a deferred object might not
be evaluated until later, and in fact might not be evaluated at all.

Deferred evaluation is a useful feature, but that isn't what I'm
proposing here. If you want to propose it as a completely separate
feature, and then posit that it makes PEP 671 unnecessary, then go
ahead; that's your proposal, not mine.

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

Reply via email to