Iterating over key/value pairs in a dict sorted by keys
<p>I have the following code, which just print the key/value pairs in a dict (the pairs are sorted by keys):</p>

<pre><code>for word, count in sorted(count_words(filename).items()):
    print word, count
</code></pre>

<p>However, calling <code>iteritems()</code> instead of <code>items()</code> produces the same output</p>

<pre><code>for word, count in sorted(count_words(filename).iteritems()):
    print word, count
</code></pre>

<p>Now, which one should I choose in this situation? I consulted the <a href="http://docs.python.org/library/stdtypes.html#dict.items">Python tutorial</a> but it doesn't really answer my question.</p>
