Fair enough. I wouldn't actually do what I suggested either. But then, I also wouldn't ever write:
x1, x2 = (-b + sqrt(D)))/2, (-b - sqrt(D))/2 [with/where/whatever D=...] If your goal is simply to have symmetry in the plus-or-minus clauses, I was simply pointing out you can have that with the ':=' syntax. Inasmuch as I might like assignment expressions, it would only be in while or if statements, personally. On Wed, Apr 11, 2018, 5:09 PM Brendan Barnwell <brenb...@brenbarn.net> wrote: > On 2018-04-11 11:05, David Mertz 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. > > That's clever, but why bother? I can already do this with > existing Python: > > D = b**2 - 4*a*c > x1, x2 = (-b + sqrt(D)))/2, (-b - sqrt(D))/2 > > If the new feature encourages people to do something like your > example > (or my earlier examples with the D definition inline in the expression > for x1), then I'd consider that another mark against it. > > -- > Brendan Barnwell > "Do not follow where the path may lead. Go, instead, where there is no > path, and leave a trail." > --author unknown >
_______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/