title: Why is append overwriting everything in the list with the new element?
body: <p>I'm writing a Python script that reads a CSV file and creates a list of deques. If I print out exactly what gets appended to the list before it gets added, it looks like what I want, but when I print out the list itself I can see that append is overwriting all of the elements in the list with the newest one.</p>
  
  <pre><code>    # Window is a list containing many instances            
  def slideWindow(window, nextInstance, num_attributes):
      attribute = nextInstance.pop(0)
      window.popleft()
      for i in range(num_attributes):
          window.pop()
      window.extendleft(reversed(nextInstance))
      window.appendleft(attribute)
      return window
  
  def convertDataFormat(filename, window_size):
      with open(filename, 'rU') as f:
          reader = csv.reader(f)
  
          window = deque()
          alldata = deque()
  
          i = 0
          for row in reader:
              if i &lt; (window_size-1):
                  window.extendleft(reversed(row[1:]))
                  i+=1
              else:
                  window.extendleft(reversed(row))
                  break
  
          alldata.append(window)
  
          for row in reader:
              window = slideWindow(window, row, NUM_ATTRIBUTES)
              alldata.append(window)
  #             print alldata
  
          f.close()
          return alldata
  </code></pre>