On Thu, Dec 2, 2021 at 2:40 AM David Mertz, Ph.D. <david.me...@gmail.com> wrote:
>
> On Wed, Dec 1, 2021 at 10:12 AM Chris Angelico <ros...@gmail.com> wrote:
>>
>> On Thu, Dec 2, 2021 at 12:42 AM David Mertz, Ph.D.
>> <david.me...@gmail.com> wrote:
>> >> 4) If "no" to question 1, is there some other spelling or other small
>> >> change that WOULD mean you would use it? (Some examples in the PEP.)
>> >
>> > Yes, the delay/later/defer keyword approach is not confusing, and does not 
>> > preempt a later feature that would actually be worth having.
>>
>> Do you mean changing the spelling of the existing proposal, or a
>> completely different proposal for deferred objects that are actually
>> objects? Because that is NOT what I mean by a "small change". :)
>
>
> The spelling of the existing proposal.  I.e. if the proposal were:
>
> def fun(things: list[int] = defer []) -> int:
>     # ... some implementation
>
>
> I'd be -0 on the idea rather than -100.

Okay. If it's JUST the spelling, then yes, I'll take that into
consideration (though I am still against keywords myself).

> Yes, my change in attitude is largely because I want *some future PEP* to 
> address the more general situation like:
>
> result = defer really_expensive_calculation()
> if predicate:
>     doubled = result * 2
>
>
> But I do not think your PEP does (nor even should) include that potential 
> future behavior/syntax.  Such a hypothetical future PEP would have a 
> continuity with the syntax of your feature, albeit DEFINITELY need to address 
> many independent concerns/issues that yours does not create.
>
> However, even if I assume the mythical future PEP never happens, in terms of 
> readability, a WORD is vastly less confusing than a combination of 
> punctuation that has no obvious or natural interpretation like '=>'.  Or 
> rather, I think that spelling is kinda-sorta obvious for the lambda meaning, 
> and the use you want is kinda-sorta similar to a lambda.  So I *do* 
> understand how you get there... but it still seems like much too much line 
> noise for a very minimal need.
>

The trouble is that this actually would be incompatible. If you can
defer an expensive calculation and have some "placeholder" value in
the variable 'result', then logically, you should be able to have that
placeholder as a function default argument, which would be an
early-bound default of the placeholder. That is quite different in
behaviour from a late-bound default, so if I were to use the word
"defer" for late-bound defaults, it would actually prevent the more
general proposal.

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

Reply via email to