Hi, Summary: In my opinion, the C-like prefix increment and decrement operators (++i and --i) should be marked as "syntax error".
Current situation: try... (Python 2.4 (#60, ...)) >>> i = 1 >>> i 1 >>> i++ File "<stdin>", line 1 i++ ^ SyntaxError: invalid syntax >>> ++i 1 >>> --i 1 >>> Reason for how ++i and --i behaves in Python is that it is probably treated as (-(-i)) and (+(+i)) respectively. Rationale: My guess is that many Python users do use other languages at the same time. The C-family languages do use the prefix increment and decrement operators. When used in Python no warning appears -- the code simply does not work as expected. In the same time, there is probably no reason to use the increment and decrement prefix operators. On the other hand, the newcommer or the programmer that "types ++i automatically because of brain synapses say he/she should..." is not warned until something does not work. Con: The situation must be recognized by the parser (i.e. someone have to implement it). Pro: No runtime overhead except of the detection of the situation. As Python is a good candidate to be used as the language for teaching, the "syntax error" would be the pedagogical plus. Personal experience: Many things in Python work intuitively. My C++ experience "forced me" to use ++i as described above. I use iteration more these days and I know about the ++i problem invisibility in Python. But I had to learn by mistake. The ++i behaviour is not intuitive for me. Your opinion? -- Petr Prikryl (prikrylp at skil dot cz) -- http://mail.python.org/mailman/listinfo/python-list