I believe the deal is that it is impossible (or at least extremely inefficient)to keep track of any places where a mutable object was hashed at the time of mutating it, so that ALL hashes can be updated. When the object is immutable, it implies that the hash will not change unless the id changes.
Hugo > Would you expect dicta[tupb] to produce "34" or "45"? And what of > dicta[tupc]? I believe this issue is one of whether to hash by identity > or content. When hashing, the implied promise is that all objects whose > contents are the same should produce the same value, but one also > expects one key to map to one value. Without immutable types, where the > identity and the content are intertwined, you get counterintuitive > behavior a la the above mini-example (in reality, when you put two > immutable objects with the same content in a dictionary, they both map > to the same value - the last one assigned). I'm sure someone more > knowledgeable will come along and shed the bright light of understanding > where my feeble candle flickers, but till then, HTH. > > -Orri > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor