dict: keys() and values() order guaranteed to be same?

Ethan Furman ethan at stoneleaf.us
Thu Jul 26 17:03:24 EDT 2012


Steven D'Aprano wrote:
> Python's promise is much stronger than merely "deterministic": while it 
> does not promise what order the keys will be returned, it does promise 
> that whatever that order turns out to be, they will returned in the same 
> order as the matching values (unless you modify the dict while iterating).

or modify the dict between iterations.

~Ethan~



More information about the Python-list mailing list