In what order does Python read dictionary keys?

tcpeter at tcpeter at
Tue Jun 8 19:27:13 EDT 1999

In article <375D8077.EA539C6D at>,
  M.Faassen at wrote:
> tcpeter at wrote:
>>  when I ran the code, the options were
> > in the desired order. (A trifle creepy, if you ask me.  Turing would
> > delighted.)  Anyway, how does Python decide the order. Thanks.
> Hi there,
> The answer is that Python doesn't have any set orders for
> The internal hashing algorithm the python dictionary uses has no
> guaranteed order. So basically you shouldn't depend on any particular
> order it produces.

OK.  So is there a way to ensure a specific order?  In this instance
I've given it's not particularly critical, but there are times where it
might be.  Any ideas?

Sent via
Share what you know. Learn what you don't.

More information about the Python-list mailing list