Order of tuples in dict.items()
sjmachin at lexicon.net
Mon Oct 15 23:11:27 CEST 2007
On Oct 16, 12:47 am, Erik Jones <e... at myemma.com> wrote:
> Not between two consecutive reads, no. However, after any resizing
> of a dict the result of Python's hash function for any given newly
> inserted key is extremely likely to be different than it would have
> been before the resizing, i.e. the method may be the same, but the
> result is different.
Could you please supply the basis for the above assertion? My reading
of the docs for the built-in hash function, the docs for an object's
__hash__ method, and the source (dictobject.c, intobject.c,
stringobject.c) indicate (as I would have expected) that the hash of
an object is determined solely by the object itself, not by the
history of insertion into a dict (or multiple dicts!?).
Note that position_in dict = some_function(hash(obj),
size_of_dict) ... perhaps you are conflating two different concepts.
More information about the Python-list