[Python-Dev] PEP 572: Assignment Expressions (original) (raw)
Ethan Furman ethan at stoneleaf.us
Tue Apr 24 10:24:12 EDT 2018
- Previous message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Next message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 04/23/2018 06:42 PM, Chris Jerdonek wrote:
On Mon, Apr 23, 2018 at 4:54 PM, Greg Ewing wrote:
Tim Peters wrote:
if (diff := x - xbase) and (g := gcd(diff, n)) > 1: return g
My problem with this is -- how do you read such code out loud? It could be-- "if diff, which we let equal x - xbase, and g, which ..." or "if diff, which we set equal to x - xbase, and g, which ...." or "if diff, which we define to be x - xbase, and g, which ...." or "if diff, which we define as x - xbase, and g, which ....." etc.
Thanks, Chris J.
For myself, I can read that as
"if diff, which is x - x_base, and g, which is ..."
That works for me.
Changing my vote to
+1 (but only for simple name bindings)
--
Ethan
- Previous message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Next message (by thread): [Python-Dev] PEP 572: Assignment Expressions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]