title: What does [[]]*2 do in python?
body: <pre><code>A = [[]]*2
  
  A[0].append("a")
  A[1].append("b")
  
  B = [[], []]
  
  B[0].append("a")
  B[1].append("b")
  
  print "A: "+ str(A)
  print "B: "+ str(B)
  </code></pre>
  
  <p>Yields:</p>
  
  <pre><code>A: [['a', 'b'], ['a', 'b']]
  B: [['a'], ['b']]
  </code></pre>
  
  <p>One would expect that the A list would be the same as the B list, this is not the case, both append statements were applied to A[0] and A[1].</p>
  
  <p>Why?</p>