On 2021-11-30 22:16, Chris Angelico wrote:
I've just updated PEP 671 https://www.python.org/dev/peps/pep-0671/ with some additional information about the reference implementation, and some clarifications elsewhere.
*PEP 671: Syntax for late-bound function argument defaults*
Questions, for you all:
1) If this feature existed in Python 3.11 exactly as described, would you use it?
I hope not. :-) Realistically I might wind up using it at some point way down the line. I wouldn't start using it immediately. I still almost never use the walrus and only occasionally use f-strings. You didn't ask how people would feel about READING this rather than writing it, but what I would do is get really annoyed at seeing it in code as people start to use it and confuse me and others.
2) Independently: Is the syntactic distinction between "=" and "=>" a cognitive burden?
(It's absolutely valid to say "yes" and "yes", and feel free to say which of those pulls is the stronger one.)
Yes, it is yet another reason not to do this.
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?
N/A.
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.)
No. As I mentioned in the earlier thread, I don't support any proposal in which an argument can "have a default" but that default is not a first-class Python object of some sort.
5) Do you know how to compile CPython from source, and would you be willing to try this out? Please? :)
No, I don't. I know I said this before, but I really hope this change is not adopted. It is to me a classic example of adding significant complexity to the language and reducing readability for only a very small benefit in expressiveness. -- Brendan Barnwell "Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail." --author unknown