[Python-Dev] PEP 572: Assignment Expressions
Ethan Furman
ethan at stoneleaf.us
Tue Apr 24 10:24:12 EDT 2018
More information about the Python-Dev mailing list
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 - x_base) 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 - x_base, and g, which ..." or > "if diff, which we set equal to x - x_base, and g, which ...." or > "if diff, which we define to be x - x_base, and g, which ...." or > "if diff, which we define as x - x_base, 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 ]
More information about the Python-Dev mailing list