Inverse of dict(zip(x,y))

Paul McGuire ptmcg at
Wed Mar 4 17:00:14 CET 2009

On Mar 4, 5:33 am, Lie Ryan <lie.1... at> wrote:
> Andre Engels wrote:
> > y = d.values() might also work, but I am not sure whether d.keys() and
> > d.values() are guaranteed to use the same order.
> If they were called immediately after each other I think they should,
> but better not rely on it.

Also, it offends my efficiency/performance sensibilities to use two
separate calls to iterate over the dict twice, when there is a
perfectly good equivalent that is just as readable and iterates only

More information about the Python-list mailing list