A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-April/152925.html below:

[Python-Dev] PEP 572: Assignment Expressions

[Python-Dev] PEP 572: Assignment ExpressionsGreg Ewing greg.ewing at canterbury.ac.nz
Tue Apr 24 03:12:52 EDT 2018
Chris Jerdonek wrote:

>>>if (diff := x - x_base) and (g := gcd(diff, n)) > 1:

> "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.

How about "being" as a keyword:

   if (diff being x - x_base) and (g being gcd(diff, n)) > 1:
     return g

An advantage is that you're not likely to be tempted to write

    diff being x - x_base

on its own as a statement.

-- 
Greg
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4