[Python-Dev] ++x oddnes

Charles G Waldman cgw@alum.mit.edu
Fri, 10 Aug 2001 10:21:58 -0500


Sorry if this is old news.  I don't remember anybody reporting this,
but I don't follow c.l.py as closely as I used to.

I've been writing a lot of C++ lately and my mind is stuck in limbo
somewhere between C++ and Python.  I inadvertently wrote the following:

x = 0
while x < 10:
      # do something
      ++x


Interestingly, this runs, it just never terminates!  Looks like
somehow ++x is being parsed as "+0 + x".  Shouldn't this construct
be flagged as a syntax error?  

This happens with both 2.1 and 2.2