title: Updating elements in nested list using 'for' won't work in python list
body: <p>So I have a 4 by 3 nested list (4 rows, 3 columns) that I have nested as follows:</p>
  
  <pre><code>&gt;&gt;&gt; c= [x[:] for x in [[None]*3]*4]
  &gt;&gt;&gt; print c
  [[None, None, None], 
   [None, None, None], 
   [None, None, None], 
   [None, None, None]]
  </code></pre>
  
  <p>I have initialized my nested list in this fashion because <a href="https://stackoverflow.com/questions/2397141/how-to-initialize-a-two-dimensional-array-in-python">this other SO question</a> does a good job of explaining why some other methods don't work. (like c = [[None]*3]*4)</p>
  
  <p>Now I want to update all elements in the first row to 0. i.e. I want to set all elements in </p>
  
  <pre><code>c[0] to 0. So I tried the following:
  &gt;&gt;&gt; for x in c[0]: x = 0
  ...
  &gt;&gt;&gt; c
  [[None, None, None], [None, None, None], [None, None, None], [None, None, None]]
  &gt;&gt;&gt;
  </code></pre>
  
  <p>As you can see, the elements were not updated.
  The following worked however:</p>
  
  <pre><code>&gt;&gt;&gt; c[0] = [0 for x in c[0]]
  &gt;&gt;&gt;
  &gt;&gt;&gt; c
  [[0, 0, 0], [None, None, None], [None, None, None], [None, None, None]]
  </code></pre>
  
  <p>And I was almost sure it would because I'm creating a new list of 0s and assigning it to c[0].</p>
  
  <p>Anyway, I then went on to use the for loop and tried to update the first column (i.e. the first element of every row) to 0 and that worked. </p>
  
  <pre><code>&gt;&gt;&gt; for x in c: x[0] = 0
  ...
  &gt;&gt;&gt; c
  [[0, None, None], [0, None, None], [0, None, None], [0, None, None]]
  </code></pre>
  
  <p>I understand that this for loop update is different from the previous for loop update since the first one tried to loop over single elements while this one loops over lists and just accesses the first element of each list.</p>
  
  <p>I'm sure I'm missing something about names pointing to other names but I can't put my finger on what the exact issue is here. Could someone please help?</p>