title: How to slice a list in Python without copying the reference?
body: <p>I need to remove the first N elements from a list inside a function and I want the original list to be modified. What is a concise way to do this in Python?</p>
  
  <p>Using a <code>slice</code> isn't working because the slice operation returns a separate reference to the list. In this example, I would like <code>pkt</code> to be <code>[3,4,5]</code> after calling the function.</p>
  
  <pre><code>&gt;&gt;&gt;&gt; def process_packet(packet, num_bytes):
           # ...
           packet = packet[num_bytes:len(packet)]
           print packet
  
  &gt;&gt;&gt; pkt = [1,2,3,4,5]
  &gt;&gt;&gt; process_packet(pkt, 2)
  [3, 4, 5]
  &gt;&gt;&gt; print pkt
  [1, 2, 3, 4, 5]
  </code></pre>