Does it mean that depending of the number of items, keys can be mutable? It sounds like a terrible idea.<div><br></div><div>Victor<br><br>Le vendredi 18 avril 2014, Jim J. Jewett <<a href="mailto:jimjjewett@gmail.com">jimjjewett@gmail.com</a>> a écrit :<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">(1)  I believe the recent consensus was that the number of comparisons<br>
made in a dict lookup is an implementation detail.  (Please correct me<br>
if I am wrong.)<br>
<br>
(2)  Is "the item will be hashed at least once" a language guarantee?<br>
<br>
For small mappings, it might well be more efficient to just store the<br>
2-3 key/value pairs and skip the bucket calculation.<br>
<br>
On the other hand, if a key is not hashable, discovering that long<br>
after it has already been added to the dict is suboptimal.<br>
<br>
Of course, that sort of delayed exception can already happen if it is<br>
the __eq__ method that is messed up ...<br>
<br>
-jJ<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="javascript:;" onclick="_e(event, 'cvml', 'Python-Dev@python.org')">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com" target="_blank">https://mail.python.org/mailman/options/python-dev/victor.stinner%40gmail.com</a><br>
</blockquote></div>