can the sequence of entries in a dictionary be depended on?

Carsten Haese carsten.haese at
Mon Nov 24 01:59:33 CET 2008

Diez B. Roggisch wrote:
> AFAIK the order is deterministic as long as you don't alter the dict between
> iterations. However, this is an implementation detail.

It's not an implementation detail. It's documented behavior. Thus quoth :

If items(), keys(), values(), iteritems(), iterkeys(), and itervalues()
are called with no intervening modifications to the dictionary, the
lists will directly correspond.

Carsten Haese

More information about the Python-list mailing list