Why does '() is ()' return True when '[] is []' and '{} is {}' return False?
问题 From what I've been aware of, using [], {} or () to instantiate objects returns a new instance of list, dict or tuple respectively; a new instance object with a new identity . This was pretty clear to me until I actually tested it and I noticed that () is () actually returns True instead of the expected False : >>> () is (), [] is [], {} is {} (True, False, False) as expected, this behavior is also manifested when creating objects with list(), dict() and tuple() respectively: >>> tuple() is