Why is b=(a+=1) an invalid syntax in python?

Viewed 2602

If I write the following in python, I get a syntax error, why so?

a = 1
b = (a+=1)

I am using python version 2.7

what I get when I run it, the following:

>>> a = 1
>>> b = (a +=1)
  File "<stdin>", line 1
    b = (a +=1)
        ^
SyntaxError: invalid syntax
>>>
4 Answers
Related