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

alex23 wuwei23 at gmail.com
Mon Apr 19 23:51:29 EDT 2010


On Apr 20, 1:03 pm, Menghan Zheng <menghan... at gmail.com> wrote:
> Is it assured the following statement is always True?
> If it is always True, in which version, python2.x or python3.x?

I believe its an implementation detail and should not be relied on. If
you need consistent ordering, use an OrderedDict[1] or sort() the
lists beforehand.



More information about the Python-list mailing list