Problem with += (augmented assignment)

mjjacob at mjjacob at
Wed Dec 13 11:39:45 EST 2000

Hi folks!

I tried this under Python 2.0 running on Win 2k:

x = 0
while x <= 42:
	x += 1

Python always complains a Syntax Error: Invalid
Syntax on this:

    x += 1
SyntaxError: invalid syntax

Augmented assignment only seems to work when used
in first indentation level (script level).
Otherwise, I always get that syntax error, it
does not matter whether I am using if, while or

Is there something terribly wrong with the +=
operator or is that all my fault?

Help appreciated.

Sent via

More information about the Python-list mailing list