On Oct 15, 2007, at 6:07 PM, Steven D'Aprano wrote: > On Mon, 15 Oct 2007 14:11:27 -0700, John Machin wrote: > >> On Oct 16, 12:47 am, Erik Jones <[EMAIL PROTECTED]> 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. > > > The hash() function doesn't even take a dictionary as an argument > -- it > simply can't be dependent on the history of insertions into the > dictionary, because it can't know what dictionary to look at! > > But as you say, the position in the dictionary itself depends on the > result of the hash function, and the size of the dictionary, and > what's > already in the dict (that is to say, the history of insertions and > deletions). That's how hash tables work.
John, sorry, I never saw your reply to my initial posting. What I was referring to was indeed the some_function in your example, not the actual hash() function available in the standard library. I was in no way conflating the two, the confusing is just one over the terminology as some_function IS a hash function. Erik Jones Software Developer | Emma® [EMAIL PROTECTED] 800.595.4401 or 615.292.5888 615.292.0777 (fax) Emma helps organizations everywhere communicate & market in style. Visit us online at http://www.myemma.com -- http://mail.python.org/mailman/listinfo/python-list