I don't understand why these functions give different results; I thought that s+=
and s=s+
were equivalent:
def foo(s):
s += ['hi']
def foo2(s):
s = s + ['hi']
But the first modifies the list s
and the second does not. Could someone help me clarifying this?