I have list objects a
and b
which look as below:
a = [1, 2, 3]
b = [1, 2, 3]
print(id(a))
print(id(b))
Output1:
1549645638528
1549650497792
Similarly, I have tuple objects a1
and b1
which look as below:
a1 = (1, 2, 3)
b1 = (1, 2, 3)
print(id(a1))
print(id(b1))
Output2:
1549643421120
1549643421120
Please help me understand why a1
and b1
are referencing to the same memory location?
And, why a
and b
are pointing to the different memory location?