Inverse of dict(zip(x,y))

Hrvoje Niksic hniksic at
Wed Mar 4 12:11:47 CET 2009

psykeedelik <icymist at> writes:

> """Keys and values are listed in an arbitrary order which is non-
> random, varies across Python implementations, and depends on the
> dictionary’s history of insertions and deletions....."""
> I hope it does not mean that the key->value mapping is not
> guaranteed, but only that the order of the [key: value] pairs would
> change. Which one is right?

The latter, of course.  The documentation is trying to warn you not to
rely on the order of returned pairs, not imply that the items() method
is unusable.

More information about the Python-list mailing list