E.g.: if (n := len(a)) > 10: print(f"List is too long ({n} elements, expected <= 10)") Gives: Error, got an unexpected token COLON here: 1 if (n :<---- here The token COLON should be one of those: COMMA, FOR, RIGHT_PARENTHESIS More info on the walrus operator here: https://docs.python.org/3/whatsnew/3.8.html