title: Python copy and concatenate linked lists, preserve order
body: <p>I have a basic linked-list implementation in python. Each <code>Cell</code> has some data associated with it and a next object, used to include the rest of the linked list (and null if only the first param of data is given in the constructor).</p>
  
  <p>I want to copy and concatenate two lists together, so that the final product preserves the order and is independent of the two original lists.</p>
  
  <p>Here is what I have:
  <pre><code>def list_concat_copy(A, B):
          C = Cell(A)
          while A.next != None:
                  A = A.next
                  C = Cell(A,C)
          C = Cell(B,C)
          while B.next != None:
                  B = B.next
                  C = Cell(B,C)
          return C</pre></code></p>
  
  <p>The issue that I am having is that this reverses the order:
  <pre><code>A = Cell(8,Cell(9,Cell(10)))
  B = Cell(11,Cell(12,Cell(13)))
  C = list_concat_copy(A,B)</pre></code></p>
  
  <p>Now if I <code>walk_and_print(C)</code> I get <code>13 12 11 10 9 8</code></p>
  
  <p>Any thoughts?</p>