title: Why does append overwrite the list with the element being added?
body: <p>I've been attempting to update two lists using this code, where numpy has been imported as <code>np</code> and where spkCount is an 8 x 10 numpy array containing either <code>1.0</code> or <code>0.0</code>:</p>
  
  <pre><code>mSpikes = []
  stdSpikes = []
  for line in spkCount:
      if line[10:-1].all() == 0:
          sample = line[0:9]
      else:
          sample = line
  
      m = np.mean(sample)
      std = np.std(sample)
      mSpikes.append(m)
      stdSpikes.append(std)
  </code></pre>
  
  <p>When I check <code>mSpikes</code> and <code>stdSpikes</code>, I find that they contain the following data:</p>
  
  <pre><code>In [52]: stdSpikes
  Out[52]: [3.2317865716108862]
  
  In [53]: mSpikes
  Out[53]: [53.333333333333336]
  </code></pre>
  
  <p>Can anybody explain why this is happening and suggest a course of action?  Thank you.</p>
  
  <p>EDIT:  I should mention that I checked if the for loop was iterating properly and it is.  The if/else statement is also being processed as expected.  The problem really does appear to be related to a numpy interaction with list.append...</p>