Inverse of dict(zip(x,y))

Tino Wildenhain tino at wildenhain.de
Wed Mar 4 06:42:22 EST 2009


Lie Ryan 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.

otoh, I could not think of any use having the two resulting sequences
relate to each other. So in fact it doesn't matter if order is
preserved or not.

Regards
Tino
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20090304/4f1ffdf4/attachment-0001.bin>


More information about the Python-list mailing list