On Apr 23, 2018, at 13:01, Ethan Furman <ethan@stoneleaf.us> wrote:
On 04/22/2018 10:44 PM, Tim Peters wrote:
I find myself warming more to binding expressions the more I keep them in mind while writing new code.
And I really like the term “binding expressions” because that’s how I think about this feature. I also think it will be easier to explain because “all it does” is bind a value to a name, and to me that’s the most powerful and valuable thing behind this feature.
So I really like being able to make the assignment in the expression, but I have a really hard time parsing it with the name first.
Me too. Plus we *already* have precedence for spelling name bindings in similar constructs, such as import statements, with statements, and exceptions. It seems like a natural and Pythonic approach to extend that same spelling to binding expressions rather than introducing new, weird, symbols. I also think it effectively solves the switch-statement problem: if (get_response() as answer) == 'yes': do_it() elif answer == 'no': skip_it() elif answer == 'maybe' okay_then() That’s Pythonic enough for jazz! -Barry