On Jan 31, 12:08 am, Dustan <[EMAIL PROTECTED]> wrote: > The underlying order is a result, in part, of the key's hash codes*. > Integers are hash coded by their integer values, therefore, they > appear in numeric order. Strings, however, use an algorithm that > ensures as unique hash codes as possible. Notice the difference: > > >>> map(hash, > > ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', > 1, 2, 3, 4, 5, 6, 7, 8]) > [-468864544, -340864157, -212863774, -84863387, 43136996, 171137383, > 299137766, 427138153, 1, 2, 3, 4, 5, 6, 7, 8] > > * emphasis on the "in part". Other factors include the amount of > memory space available, order added, the current size of the > underlying hash table, etc.
BTW, can anybody explain me how is the hash function implemented in Python? Cheers, -- Richard -- http://mail.python.org/mailman/listinfo/python-list