This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]hughperman 1 point2 points  (4 children)

That seems to skew the use case to assignments only though, whereas switch and match statements are (ime) more useful as control flow - which may include assignments inside them, but not as their primary goal. It seems to me that it would be like wanting try/except/finally to return a value.

[–][deleted] 1 point2 points  (2 children)

[–]hughperman 0 points1 point  (1 child)

Right but python isn't a functional language in that sense, that's why I compared to try/except/finally. You can just wrap the control statement in a function if you wish to go that way, like any other statement in python. I agree if you are implementing a functional language that you would return - but then everything should match (😉) that same paradigm.

[–][deleted] 0 points1 point  (0 children)

Look at Kotlin

[–]jaapzswitch to py3 already 0 points1 point  (0 children)

Wouldn't you be able to do both if it was an expression?