title: Dictionary creation with fromkeys and mutable objects. A surprise
body: <p>I came across this behavior that surprised me in 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, <code>dict</code> 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>Why does <code>fromkeys</code> behave like that?</p>