Problem with += (augmented assignment)

mjjacob at my-deja.com mjjacob at my-deja.com
Wed Dec 13 17:39:45 CET 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
whatever.

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

Help appreciated.


Sent via Deja.com
http://www.deja.com/



More information about the Python-list mailing list