[Python-ideas] PEP 572: Assignment Expressions (post #4)

Paul Moore p.f.moore at gmail.com
Wed Apr 11 17:03:30 EDT 2018


On 11 April 2018 at 19:05, David Mertz <mertz at gnosis.cx> wrote:
> How about this, Brendan?
>
> _, x1, x2 = (D := b**2 - 4*a*c), (-b + sqrt(D))/2, (-b - sqrt(D))/2
>
> I'm not sure I love this, but I don't hate it.

Seriously, how is this in any way better than

D = b**2 - 4*a*c
x1, x2 = (-b + sqrt(D))/2, (-b - sqrt(D))/2

?

There are good use cases for this feature, but this simply isn't one.

Paul


More information about the Python-ideas mailing list