title: What is the most pythonic way to pop a random element from a list?
body: <p>Say I have a list <code>x</code> with unkown length from which I want to randomly pop one element so that the list does not contain the element afterwards. What is the most pythonic way to do this?</p>
  
  <p>I can do it using a rather unhandy combincation of <code>pop</code>, <code>random.randint</code>, and <code>len</code>, and would like to see shorter or nicer solutions:</p>
  
  <pre><code>import random
  x = [1,2,3,4,5,6]
  x.pop(random.randint(0,len(x)-1))
  </code></pre>
  
  <p>What I am trying to achieve is consecutively pop random elements from a list. (i.e., randomly pop one element and move it to a dictionary, randomly pop another element and move it to another dictionary, ...)</p>
  
  <p>Note that I am using Python 2.6 and did not find any solutions via the search function.</p>