53
Python Mutability
(programming.dev)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
As I would expect. Does the result surprise people?
If so, rename the arguments to
fun()
to be r, s, t, and u. Just inside the function. Does the obvious two scopes now make it clearer?The fact that
x += y
modifieslist
s in place might be surprising if you're expecting it to be exactly equivalent tox = x + y
.Yes, that is a surprise to many, in other languages 'x+=y' and 'x=x+y' are the same.