given i = 0,
I know i = i + 1 and i += 1 are all correct
but when I type:[color=blue][color=green][color=darkred]
>>> i++[/color][/color][/color]
the interpreter replies:
File "<stdin>", line 1
i++
^
SyntaxError: invalid syntax
so I get the idea that suffix ++ is invalid in python
but when I input:[color=blue][color=green][color=darkred]
>>> ++i[/color][/color][/color]
and the interpreter replies
0
Don't you think it is misleading when you expect a variable to
increment?
I know i = i + 1 and i += 1 are all correct
but when I type:[color=blue][color=green][color=darkred]
>>> i++[/color][/color][/color]
the interpreter replies:
File "<stdin>", line 1
i++
^
SyntaxError: invalid syntax
so I get the idea that suffix ++ is invalid in python
but when I input:[color=blue][color=green][color=darkred]
>>> ++i[/color][/color][/color]
and the interpreter replies
0
Don't you think it is misleading when you expect a variable to
increment?
Comment