Hi Jim, On 18 April 2014 23:46, Jim J. Jewett <jimjjew...@gmail.com> wrote: > (2) Is "the item will be hashed at least once" a language guarantee?
I think that a reasonable implementation needs to hash at least once all keys that are added to the dictionary. Otherwise we end up, as you said, with a dictionary that contains non-hashable keys: this crashes when it grows and tries to convert from a list storage to a hash table. This is against the expectations and probably against the language spec... It's a bit unclear to me if the language spec requires "if [ ] in mydict:" to raise TypeError, as the key doesn't get added to the dict in this case. Similarly for "[ ] in { }" where the dictionary is empty anyway. I would say yes, erring on the side of caution... A bientôt, Armin. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com