dict.keys() and dict.values() are always the same order, is it?

alex23 wuwei23 at gmail.com
Tue Apr 20 06:31:10 CEST 2010

Cameron Simpson <c... at zip.com.au> wrote:
>   If items(), keys(), values(), iteritems(), iterkeys(), and
>   itervalues() are called with no intervening modifications to the
>   dictionary, the lists will directly correspond. This allows the
>   creation of (value, key) pairs using zip(): pairs = zip(d.values(),
>   d.keys()).

I stand corrected. Thanks Cameron.

More information about the Python-list mailing list