4 ms·
Wonderful reference for comparison! I admittedly haven't had time to pursue the whole table, but wanted to point out that there is indeed an increment and decre
by alexm920 15y ago
Wonderful reference for comparison! I admittedly haven't had time to pursue the whole table, but wanted to point out that there is indeed an increment and decrement in python:
x += 1
x -= 1
- mistercow 15y agoThey list those under "compound assignment operators", which makes sense given that += and -= are found in all of these languages. It's also worth noting that compound assignment operators do not form expressions in Python. So "i++" in PHP/Perl/Ruby is very different from "i += 1" in Python.
- balloot 15y agoAn increment/decrement operator is unary and doesn't give you the ability to change the value by any more than one.