Chris Angelico wrote:
I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/ Questions, for you all: 1) If this feature existed in Python 3.11 exactly as described, would you use it?
When needed, but I'm uncomfortable with the syntax.
2) Independently: Is the syntactic distinction between "=" and "=>" a cognitive burden?
Yes. A lot of arrows with different meanings require the reader of the code to know and remember what each does. Something more distinctive feels better. I'm way too new to Python to have much say, but anyway, arrows make more sense for other uses. Late binding feels to me like it is best served by something more distinctive.
3) If "yes" to question 1, would you use it for any/all of (a) mutable defaults, (b) referencing things that might have changed, (c) referencing other arguments, (d) something else?
I'd certainly use it only when I felt it was absolutely necessary. The readability is not aided by utilising syntax to alter behaviour when the altered behaviour is not required. We only quote, escape, etc., when we need to. (Silly example to illustrate, I know.)
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.)
When I first saw this (very few months ago indeed!!), I wondered about something rather clunkier but more explicit, such as, for example -- ```def foo(x=__late__['bar']): def bar(): #something etc... ``` Ugly though. And I subsequently realised some use cases are not well-served by this. (Particularly when [speculatively] considering some implementation issues.) The point in any case, is that for the occasions when the mechanism is needed, then a clearly explicit way to indicate something is evaluated late, and a tidy place to put the definition of how it's handled (late), seemed to me to be preferable. Of the **cited** examples, I find the `@hi=len(a)` spelling most readable.
5) Do you know how to compile CPython from source, and would you be willing to try this out? Please? :)
Sadly not yet, but time permitting I will one day figure that out, for sure.
bikeshedding is what we do best!
Should we introduce choice of colour, as we run out of new symbols to use? /jk JL