[Python-Dev] PEP 572: Assignment Expressions (original) (raw)

Jeff Allen ja.py at farowl.co.uk
Tue Apr 24 03:14:12 EDT 2018


On 24/04/2018 02:42, Chris Jerdonek wrote:

On Mon, Apr 23, 2018 at 4:54 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> 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 define as x - xbase, and g, which ....." etc. That's good. It also makes it natural to expect only a simple name. One can "define" a name, but assignment to a complex left-side expression is not definition (binding).

Jeff Allen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20180424/1f54a4f0/attachment.html>



More information about the Python-Dev mailing list