def func(val1):
print('val1: {}, id: {}'.format(val1, id(val1))) # val1: [1, 2, 3], id: 43499976
val2 = val1
print('val2: {}, id: {}'.format(val2, id(val2))) # val2: [1, 2, 3], id: 43499976
val2.append(4)
print('val2: {}, id: {}'.format(val2, id(val2))) # val2: [1, 2, 3, 4], id: 43499976
val2 = val2 + [5]
print('val2: {}, id: {}'.format(val2, id(val2))) # val2: [1, 2, 3, 4, 5], id: 43500296
a = [1, 2, 3]
print('a: {}, id: {}'.format(a, id(a))) # a: [1, 2, 3], id: 43499976
func(a)
print('a: {}, id: {}'.format(a, id(a))) # a: [1, 2, 3, 4], id: 43499976
参考