print id ([]) == id([])
>>> True
Why? Because:
id([]) creates a list, gets the id, and deallocates the list. The second time around it creates a list again, but "puts it in the same place" because nothing much else has happened. id is only valid during an object's lifetime, and in this case its lifetime is virtually nil
So whats the difference here?
print id ({}) == id([])
>>> False
Shouldn't it be creates a dict, gets the id and dealocates the dict, then create a list puts it in the same because nothing much else has changed?