![](https://secure.gravatar.com/avatar/880ac02012dcaf99f0392f69af4f8597.jpg?s=120&d=mm&r=g)
On Fri, Jun 17, 2022 at 06:32:36AM +0100, Rob Cliffe wrote:
The bar for adding a new hard keyword to Python is very high. Likewise for new syntax. I would suggest less so, provided that it was previously illegal, because it's backward-compatible, unlike a new keyword.
The suggestion is to add a new keyword to a PEP which absolutely doesn't need it, *shrug* Well, I have heard many times how high the bar is, so I'm surprised that suggesting a completely unnecessary one gets no more from you than a shrug.
The match...case statement didn't "need" keywords either, we could have picked symbols instead if we wanted to look like APL. Remember that keywords have advantages as well as disadvantages. Given the existence of community support for keywords, the PEP should make the case that symbols are better in this case.
Even if that's only "a majority prefer symbols". I did mention the readability issue towards the end of my post.
on the grounds that it **might** (**not** would - we can't know without a spec) give compatibility with some fictional vapourware which - for all people keep talking about it - hasn't happened in years, isn't happening (AFAIK nobody is working on it), doesn't have anything remotely close to even an outline specification (people disagree as to what it should do), very likely never will happen, and at best won't happen for years. I think that is broadly accurate. Harsh but fair: nobody has a concrete plan for generalising "defer" keyword would do. It is still vapourware. Thank you.
[...]
def f(x = later -y): Is that a late-bound default of -y? Bad luck; it's already legal syntax for an early-bound default of `later` minus `y`. Good catch. Thank you.
Late-bound defaults are meant to be evaluated at function call time (and in particular, not some way down in the function body when the parameter gets used). Not necessarily.
I don't recall if this has been raised in this thread before, but it is possible to delay the evaluation of the default value until it is actually needed. I believe that this is how Haskell operates pretty much everywhere. (Haskell experts: do I have that correct?) Sorry, but what on earth is the relevance of this? Python is not Haskell. And it can be vital that the evaluation of late-default values is *not* delayed (it should be guaranteed if PEP 671 is accepted). Example 1: def f(startTime => timeNow()): < 10-minute calculation > endTime = timeNow() print('Elapsed time:', endTime-startTime) # Help, why is this
On 18/06/2022 03:28, Steven D'Aprano wrote: printing "Elapsed time: -0.001"? Example 2: def g(x, y=>x**2): x = x+1 print(y) Best wishes Rob Cliffe