[EMAIL PROTECTED] wrote: > given i = 0, > I know i = i + 1 and i += 1 are all correct > but when I type: > >>>>i++ > > 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: > >>>>++i > > and the interpreter replies > 0 > > Don't you think it is misleading when you expect a variable to > increment? > Terribly. So stop expecting it to increment :)
Seriously, --i is also valid Python. Both expressions apply two unary operators to a name. Would you have these become illegal, or start to mean increment/decrement? Either change would break years of backwards compatibility. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd http://www.holdenweb.com Love me, love my blog http://holdenweb.blogspot.com Recent Ramblings http://del.icio.us/steve.holden -- http://mail.python.org/mailman/listinfo/python-list