As far as I know, python list is a dynamic array. So when we reach a certain size, the capacity of that list will be increased automatically. But the problem is, unlike dynamic array of c or c++, even after increasing the capacity of list instance, the location is not being changed. Why is it happening?
I've tested this using the following code block
l = []
print(l.__sizeof__())
print(id(l))
for i in range(5_000_000):
l.append(i)
print(l.__sizeof__())
print(id(l))