why no ++?
charlie at begeistert.org
Fri Aug 3 13:59:26 CEST 2001
Mark Robinson wrote:
> Just wondering. Can anyone tell me the rationale for leaving the ++/--
> operator out of python. It is perhaps my only irritation with python,
> it is just that I hate to have to write:
> x = x + 1
no you don't.
> when my whole being just yearns to type
control yourself. Why should you want to type that? It's not necessary
in Python's loops which automatically increment for you.
> I guess it is perhaps not as clear, but I am not aware of it being a
> common cause of errors in C++ or java (doesn't mean it isn't, just
> I am not aware of them). I also miss +=, *=, %=, /=, would it really
> make the code that much harder to read/maintain?
"Incremental operators" arrived in Python 2.0. They weren't "left out"
before just not implemented. Features should only be added to a language
when a real case for them can be made and the PEPs now give a valuable
insight into this process in Python. I like Python because when I read
the discussions I understand why things are or are not there. Check
which version of Python you've got and upgrade if necessary. Python 2.0
and Python 2.1 include a whole set of improvements see Andrew Kuchling's
readme's on the website.
More information about the Python-list