 <p>From python's <a href="https://docs.python.org/2/library/stdtypes.html#mapping-types-dict" rel="nofollow">docs</a>:</p> <p>iter(dictview)</p> <pre><code>Return an iterator over the keys, values or items (represented as tuples </code></pre> <p>of (key, value)) in the dictionary.</p> <pre><code>Keys and values are iterated over in an arbitrary order which is </code></pre> <p>non-random, varies across Python implementations, and depends on the dictionary’s history of insertions and deletions. If keys, values and items views are iterated over with no intervening modifications to the dictionary, the order of items will directly correspond. </p> <p>I would try with the order of inclusion since it seems you are not deleting values.</p>