@@ -526,14 +526,16 @@ far) under most circumstances, and the implementation is simpler.
526526
527527Dictionaries work by computing a hash code for each key stored in the dictionary
528528using the :func: `hash ` built-in function. The hash code varies widely depending
529- on the key; for example, "Python" hashes to -539294296 while "python", a string
530- that differs by a single bit, hashes to 1142331976. The hash code is then used
531- to calculate a location in an internal array where the value will be stored.
532- Assuming that you're storing keys that all have different hash values, this
533- means that dictionaries take constant time -- O(1), in computer science notation
534- -- to retrieve a key. It also means that no sorted order of the keys is
535- maintained, and traversing the array as the ``.keys() `` and ``.items() `` do will
536- output the dictionary's content in some arbitrary jumbled order.
529+ on the key and a per-process seed; for example, "Python" could hash to
530+ -539294296 while "python", a string that differs by a single bit, could hash
531+ to 1142331976. The hash code is then used to calculate a location in an
532+ internal array where the value will be stored. Assuming that you're storing
533+ keys that all have different hash values, this means that dictionaries take
534+ constant time -- O(1), in computer science notation -- to retrieve a key. It
535+ also means that no sorted order of the keys is maintained, and traversing the
536+ array as the ``.keys() `` and ``.items() `` do will output the dictionary's
537+ content in some arbitrary jumbled order that can change with every invocation of
538+ a program.
537539
538540
539541Why must dictionary keys be immutable?
0 commit comments