<br><br><div class="gmail_quote">On Tue, Oct 12, 2010 at 3:39 PM, Sander Sweers <span dir="ltr">&lt;<a href="mailto:sander.sweers@gmail.com">sander.sweers@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On 12 October 2010 21:15, Joel Goldstick &lt;<a href="mailto:joel.goldstick@gmail.com">joel.goldstick@gmail.com</a>&gt; wrote:<br>
&gt; When the dictionary is retrieved, its order depends on the hashed values<br>
&gt; rather than the keys themself.<br>
<br>
</div>If (big IF here) you really need an ordered dict you can use the<br>
OrderedDict from the collections module. However this will only<br>
guarantee *insertion* order (except for existing keys). Do make sure<br>
you read pep 372 [1].<br>
<br>
Greets<br>
Sander<br>
<br>
[1] <a href="http://www.python.org/dev/peps/pep-0372/" target="_blank">http://www.python.org/dev/peps/pep-0372/</a><br>
<div><div></div><div class="h5">_______________________________________________<br clear="all"></div></div></blockquote><div><br>It seems a common practice to create an ordered list of the keys, then iterate over the list to operate on the dictionary. </div>
</div><br>-- <br>Joel Goldstick<br><br>