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):
Hence the former can be used in contexts like "if x := 10: pass", which is the whole point of the PEP.
The sugar is sprinkled on top of syntax, the stuff the parser deals with. Typing a += 1 instead of a = a + 1 is sugar because it parses the same. This assignment syntax seems different. IMHO.
Does not. One is addition, the other is in-place addition; they're different things and can behave differently. E.g. in "a += b" and "a = a + b", the former might not construct an intermediate object, but mutate the existing a.
"__iadd__" and "__add__" can do whatever they want.