2 ms·
TLDR: The abbreviation mutates the LHS, while the long version assigns a newly created object to it. >>> orig = [1,2,3] >>> L1 = orig >>> L2 = [7,8] >>
by FabHK 5y ago
TLDR: The abbreviation mutates the LHS, while the long version assigns a newly created object to it.
>>> orig = [1,2,3]
>>> L1 = orig
>>> L2 = [7,8]
>>> L1 = L1 + L2
>>> orig
[1, 2, 3]
>>> orig = [1,2,3]
>>> L1 = orig
>>> L2 = [7,8]
>>> L1 += L2
>>> orig
[1, 2, 3, 7, 8]