title: Python: Replacing an element in a list of lists (#2)
body: <p>A previous question with the same title as mine <a href="https://stackoverflow.com/questions/2104796/python-replacing-item-in-a-list-of-lists">has been posted</a>, with (I think) the same question, but had other problems in the code. I was not able to determine if that case was identical to mine or not.</p>
  
  <p>Anyway, I want to replace an element within a list in a list.
  Code:</p>
  
  <pre><code>myNestedList = [[0,0]]*4 # [[0, 0], [0, 0], [0, 0], [0, 0]]
  myNestedList[1][1] = 5
  </code></pre>
  
  <p>I now expect:</p>
  
  <pre><code>[[0, 0], [0, 5], [0, 0], [0, 0]]
  </code></pre>
  
  <p>But I get:</p>
  
  <pre><code>[[0, 5], [0, 5], [0, 5], [0, 5]]
  </code></pre>
  
  <p>Why?</p>
  
  <p>This is replicated in the command line.
  Python 3.1.2 (r312:79147, Apr 15 2010, 15:35:48) 
  [GCC 4.4.3] on linux2</p>