i_do_not_agree
Re:PEP 572: Python assignment expressions has been accepted
on Tuesday July 03, 2018 @07:32AM (#17449279)
Perhaps s/he was looking at Lisp/Scheme:
(define (foo x)
(if (bar x)
1
#f))
The returned value is the value of the last expression. No need for an else, or a return keyword.
Re:PEP 572: Python assignment expressions has been accepted
on Tuesday July 03, 2018 @06:25AM (#17449000)
This is horrible. It looks like ":=" is a comparison operator. The last line is dangerously close to Erlang list comprehensions:
[ {X, Y, X/Y} || X <- Some_Function (), Y <- Some_Other_Function () ]
And people bitch about Erlang syntax.
Edit: "/" is the division operator
Re:PEP 572: Python assignment expressions has been accepted
on Tuesday July 03, 2018 @06:16AM (#17448972)
Just need something like blocks in Smalltalk. Wikipedia page on list comprehensions says Smalltalk-80 had list comprehensions and that was ~ 40 years ago.
Smalltalk also uses ":=" for assignment and "=" for comparison. In Pharo, VA and Dolphin at least does what this Python proposal does - return the value of the last expression.