In [1]: l1 = [1, 2, 3, [4, 5], (7,8)] In [2]: l2 = l1 In [3]: id(l1), id(l2) Out[3]: (4360956240, 4360956240) In [4]: l1[3].append(6) In [5]: l1 Out[5]: [1, 2, 3, [4, 5, 6], (7, 8)] In [6]: l2 Out[6]: [1, 2, 3, [4, 5, 6], (7, 8)] In [7]: id(l1), id(l2) Out[7]: (4360956240, 4360956240) In [8]: l2[0] = 0 In [9]: l2 Out[9]: [0, 2, 3, [4, 5, 6], (7, 8)] In [10]: l1 Out[10]: [0, 2, 3, [4, 5, 6], (7, 8)] In [11]: l1 is l2 Out[11]: True In [12]: id(l1[3]) Out[12]: 4360955808 In [13]: id(l2[3]) Out[13]: 4360955808
|