Why is there no post-pre increment operator in python
roy at panix.com
Fri Jan 13 04:40:00 CET 2006
riteshtijoriwala at gmail.com wrote:
> Anyone has any idea on why is there no post/pre increment operators in
> python ?
Short answer: Because Guido didn't like them.
Longer answer: Because they encourage people to write cryptic one-liners.
There really isn't anything you can't write with them that you couldn't
write just as well without them. It just takes another line or two of
code. The end result may be a little longer, but it's almost always easier
> Although the statement:
> works but does nothing
Well, it works in the sense that it's not a syntax error, but it doesn't
quite do nothing. It applies the unary + operator to the value of j, then
does it again, then throws away the result. Granted, that's probably not
what you expected, and probably not very useful, but it's not quite
More information about the Python-list