3 ms·
Python doesn't have typed variables, it has names (or references) and objects. If you start off with: a=c=[1,2,3] b=[4,5] then a=a+b with seman
by maxerickson 5y ago
Python doesn't have typed variables, it has names (or references) and objects.
If you start off with:
a=c=[1,2,3]
b=[4,5]
then
a=a+b
with semantics that change 'a' would also change the object pointed to by 'c', which I think isn't what most people would expect (and is not the semantics specified by Python).
The other forms explicitly change the object pointed to by 'a'.