←back to thread

317 points est | 1 comments | | HN request time: 0s | source
Show context
gbfowler ◴[] No.17448582[source]
It is not syntactic sugar, "x := 10" is an assignment expression in contrast with "x = 10", which is a statement.

Hence the former can be used in contexts like "if x := 10: pass", which is the whole point of the PEP.

replies(2): >>17448624 #>>17448651 #
1. senatorobama ◴[] No.17448651[source]
so now you can do

if ((int test = my_func_call()) == BLAH) { do_foo(); }