Problem with += (augmented assignment)
Rodrigo Senra
rodsenra at correionet.com.br
Wed Dec 13 13:15:00 EST 2000
mjjacob at my-deja.com wrote:
>
> 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).
It works for me( as expected ;o)
>>> x=0
>>> x += 2
>>> while x<=42:
... x+=1
... print x
...
3
4
.... and so it goes!
It is not a bug in the distribution!
What environment are you using to edit the code ?
Maybe what you see is not what is being fed to the interpreter.
Strange nevertheless.
regards
Rod
--
Rodrigo Senra
Computer Engineer (GPr Sistemas Ltda) rodsenra at correionet.com.br
MSc Student of Reflection (IC- UNICAMP) Rodrigo.Senra at ic.unicamp.br
http://www.ic.unicamp.br/~921234 (see also http://www.gpr.com.br)
More information about the Python-list
mailing list