title: Popping all items from Python list
body: <p>I'm wondering if there is a way to "pop all" items from a list in Python? </p>
  
  <p>It can be done in a few lines of code, but the operation seems so simple I just assume there has to be a better way than making a copy and emptying the original. I've googled quite a bit and searched here, but to no avail. </p>
  
  <p>I realize that popping all items will just return a copy of the original list, but that is exactly why I want to do just that. I don't want to return the list, but rather all items contained therein, while at the same time clearing it.</p>
  
  <pre><code>class ListTest():
      def __init__(self):
          self._internal_list = range(0, 10)
  
      def pop_all(self):
          result, self._internal_list = self._internal_list[:], []
          return result
  
          # ... instead of:
          # return self._internal_list.pop_all()
  
  
  t = ListTest()
  
  print "popped: ", t.pop_all()
  print "popped: ", t.pop_all()
  </code></pre>
  
  <p>... which of course returns the expected:</p>
  
  <pre><code>popped:  [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
  popped:  []
  </code></pre>