Why there is no difference between shallow copy and deep copy for a list of immutables
问题 Suppose i have a python list l consisting of immutables. When i am doing a shallow copy and a deep copy , the result is same: >>> a = (1,2) # immutable types >>> b = (3,4) >>> l = [a,b] # a list containing immutable types >>> import copy >>> y = copy.copy(l) # shallow copy >>> z = copy.deepcopy(l) # deep copy >>> id(l[0]) 139857440375584 >>> id(y[0]) 139857440375584 >>> id(z[0]) 139857440375584 # all have the same id's , so all refer to the same object Does it means that shallow copy and deep