On 07/23/2012 01:23 PM, Henrik Faber wrote:
> With an arbitrary dictionaty d, are d.keys() and d.values()
> guaraneed to be in the same order?

Yes. From the documentation[1]:

If items(), keys(), values(), iteritems(), iterkeys(), and itervalues()
are called with no intervening modifications to the dictionary, the
lists will directly correspond.

In most cases, you should simply use items() though. Can you elaborate
on the use case for needing both keys() and values(), where items() is
not applicable?

- Philipp

[1] http://docs.python.org/library/stdtypes.html#dict.items

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to