auto-increment operator - why no syntax error?

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Dec 8 20:13:57 EST 2007


On Sat, 08 Dec 2007 16:58:25 -0800, Karthik Gurusamy wrote:

> Why are the following accepted even without a warning about syntax
> error?
> (I would expect the python grammar should catch these kind of syntax
> errors)
> 
>>>> n = 1
>>>> 2 * +++++ n
> 2
>>>> n += 1
>>>> n
> 2
>>>> ++n
> 2

There is no syntax error.  It is just some unary pluses "chained".  Maybe
unexpected but no syntax error.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list