Why deepcopy of list of integers returns the same integers in memory?
问题 I understand the differences between shallow copy and deep copy as I have learnt in class. However the following doesn't make sense import copy a = [1, 2, 3, 4, 5] b = copy.deepcopy(a) print(a is b) print(a[0] is b[0]) ---------------------------- ~Output~ >False >True ---------------------------- Shouldn't print(a[0] is b[0]) evaluate to False as the objects and their constituent elements are being recreated at a different memory location in a deep copy? I was just testing this out as we had