On 1 Dec 2021, at 10:16 AM, Chris Angelico firstname.lastname@example.org 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:
- If this feature existed in Python 3.11 exactly as described, would
you use it?
Yes I will use it.
- Independently: Is the syntactic distinction between "=" and "=>" a
No, because it would look like a lambda (if the new lambda syntax were approved), indicating this will be evaluated each time the function is run.
(It's absolutely valid to say "yes" and "yes", and feel free to say which of those pulls is the stronger one.)
- 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 will definitely use it for default mutable collections like list, set, dictionary etc. I will also use it to reference things that might have changed. For example, when making callbacks to GUI push buttons, I find myself at the start of the function/callback to be fetching the values from other widgets so we can do something with them. Now those values can be directly passed as late-bound defaults from their respective widgets (e.g., def callback(self, text1 => self.line_edit.text()): …).
- 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.)
- Do you know how to compile CPython from source, and would you be
willing to try this out? Please? :)
I haven’t done it from source. I might try to learn how to do it in the next weekend and give it a try.
I'd love to hear, also, from anyone's friends/family who know a bit of Python but haven't been involved in this discussion. If late-bound defaults "just make sense" to people, that would be highly informative.
I will show this to some of my coworkers who are python experts and I will report back.
Any and all comments welcomed. I mean, this is python-ideas after all... bikeshedding is what we do best!
The reference implementation currently has some test failures, which I'm looking into. I'm probably going to make this my personal default Python interpreter for a while, to see how things go.
ChrisA _______________________________________________ Python-ideas mailing list -- email@example.com To unsubscribe send an email to firstname.lastname@example.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://email@example.com/message/UVOQEK... Code of Conduct: http://python.org/psf/codeofconduct/