Dictionary creation with fromkeys and mutable objects. A surprise
<p>I came to this behavior that surprised me:</p>

<p>Python 2.6 and 3.2</p>

<pre><code>&gt;&gt;&gt; xs = dict.fromkeys(range(2), [])
&gt;&gt;&gt; xs
{0: [], 1: []}
&gt;&gt;&gt; xs[0].append(1)
&gt;&gt;&gt; xs
{0: [1], 1: [1]}
</code></pre>

<p>However, dict comprehensions in 3.2 show a more polite demeanor:</p>

<pre><code>&gt;&gt;&gt; xs = {i:[] for i in range(2)}
&gt;&gt;&gt; xs
{0: [], 1: []}
&gt;&gt;&gt; xs[0].append(1)
&gt;&gt;&gt; xs
{0: [1], 1: []}
&gt;&gt;&gt; 
</code></pre>

<p>How comes ? Why <code>fromkeys</code> behaves like that ?</p>
