>>> A = [1,2,3,4]
>>> D = A
>>> D
[1, 2, 3, 4]
>>> D = D + [5]
>>> A
[1, 2, 3, 4]
>>> C = A
>>> C += [5]
>>> A
[1, 2, 3, 4, 5]
Why does C += [5]
modifies A
but D = D + [5]
doesn't?
Is there any difference between =
and +=
in python or any other language in that sense?