Possible Duplicate:
Why there are no ++ and — operators in Python?
This question may seem strange, but I’m wondering why is there no such operation in Python.
I know, x += 1 is almost as simple as x++, but still. There is such operation in most languages I’m familiar with (C, C++, Java, C#, JavaScript, PHP), but there isn’t in Python.
Maybe it has something to do with the phylosophy of this language?
To avoid preincrement, postincrement confusions and to keep things simple.
Also datatypes such as
int,longare immutable. Meaning of++,--operators is to change the current datatype. Hence not supported.After an increment operation the python object itself changes.
Duplicate question as following which have more info :
Why are there no ++ and – operators in Python?
Behaviour of increment and decrement operators in Python