I am sorry if this question is replied somewhere since python (2.7) is a huge topic here, but I am not sure how to even look for it. I am having this code.
>>> v=[1,2,3]
>>> f=v
>>> v+=[]
>>> f is v
True
>>> v=v+[]
>>> f is v
False
Could explain to me why +=
operator is different from v=v+
? Why does the first one doesn't create a new object in memory whereas another does although they are bound to be equivalent?