a = (1,2)
b = {a:1}
print(b[a]) # This gives 1
a = (1,2,3)
print(b[a]) # This gives error but b[(1,2)] is working fine
What I understood is python doesn't run garbage collector after a is changed to (1,2,3) as the tuple (1,2,3) is created as a new object and the tuple (1,2) is still being referenced in b.
What I didn't understood is why 'b' doesn't change the key after 'a' is changed