Which is what every language with a C inheritance does. += has always mutated the original value, I don't know why you expected it to be different.
To me the real wtf is the second, where python creates a variable with the same name and discards it.
To me the real wtf is the second, where python creates a variable with the same name and discards it.
void increment(int x) {
x += 1;
}
void printit() {
int y = 0;
increment(y);
printf("%d\n", y);
}
C doesn't have lists so I had to use an int here, but the Python example does the equivalent of that code printing 1, not 0. (But only for lists. That same Python code with ints does what you expect.)