title: incrementing elements of 2d list in python
body: <p>I've noticed something strange when trying to implement elements of a 2d list in python.  Here is my code</p>
  
  <pre><code>n_dk=2*[5*[0]]
  n_dk[0][0]+=1
  print n_dk
  </code></pre>
  
  <p>I would expect the output to be</p>
  
  <pre><code>[[1,0,0,0,0],[0,0,0,0,0]]
  </code></pre>
  
  <p>but the actual output is</p>
  
  <pre><code>[[1,0,0,0,0],[1,0,0,0,0]]
  </code></pre>
  
  <p>can anyone tell me what I am doing wrong.  btw I used a numpy array instead and it worked the way I wanted it to.</p>