Re:“I'm basically giving myself a permanent vacation from be...
by ehsankia on Thursday July 12, 2018 @05:02PM
(#17518581)
Is the final syntax := surrounded by parenthesis?
Re:“I'm basically giving myself a permanent vacation from be...
by hermitdev on Thursday July 12, 2018 @05:05PM
(#17518604)
Yes
Re:“I'm basically giving myself a permanent vacation from be...
by int_19h on Thursday July 12, 2018 @09:13PM
(#17519854)
If the PEP that's published is final, then it only requires parens in certain context to make things clearer, like on the right side of the assignment statement.
Re:“I'm basically giving myself a permanent vacation from be...
by skywhopper on Friday July 13, 2018 @01:21AM
(#17520692)
Yeesh, that’s a sad thing to burn out over. Python made this decision to avoid assignment expressions a long time ago and has done fine without this capability. Why not just leave well enough alone? Adding a new variation to assignment syntax (just because of the opinion that = vs == is too confusing (even though C and Ruby and many other languages deal with it fine)) is just going to add more confusion to the language. For a line saved here and there?
Re:“I'm basically giving myself a permanent vacation from be...
by cben on Saturday July 14, 2018 @02:44PM
(#17531699)
I had the same gut reaction when I heard the PEP even exists.
But now I actually read the PEP, it's very well written and makes a reasonably good case that in specific scenarios it will be an improvement.
(My second gut reaction was it should have used `as NAME` postfix syntax. The PEP debunks that too. Turns out it previously proposed that and the switch to := was a major improvement :-)
The bigger question is whether the gains justify making the language larger... That's subjective, impossible to settle by debate, and the kind of thing a BDFL can help decide one way or the other :-)
PEP 572: Python assignment expressions has been accepted
https://news.ycombinator.com/item?id=17448439