Re: [Python-Dev] PEP 572: Assignment Expressions

2018年4月23日 00:31:09 -0700

On 2018年4月23日 00:44:44 -0500
Tim Peters <[email protected]> wrote:
> 
> Which this alternative expresses directly:
> 
> if (diff := x - x_base) and (g := gcd(diff, n)) > 1:
> return g
> 
> That's so Pythonic I could cry ;-)
It looks like C to me. That won't make me cry (I write C++ code daily
these days), but it's certainly not the same language as Python.
The second part, especially, where you use the result of an
assignment expression as a comparison operand, looks definitely
un-Pythonic.
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
[email protected]
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to