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