title: Python equivalent for Ruby combination method
body: <p>Is there <strong><em>idiomatic python way</em></strong> to list all combinations of specific size from a list?</p>
  
  <p>The following code works in ruby (<a href="http://ruby-doc.org/core-1.9.3/Array.html#method-i-combination" rel="nofollow">here</a>), I wonder if there is python equivalent for this:</p>
  
  <pre><code>a = [1, 2, 3, 4]
  a.combination(1).to_a  #=&gt; [[1],[2],[3],[4]]
  a.combination(2).to_a  #=&gt; [[1,2],[1,3],[1,4],[2,3],[2,4],[3,4]]
  a.combination(3).to_a  #=&gt; [[1,2,3],[1,2,4],[1,3,4],[2,3,4]]
  </code></pre>
  
  <p>PS: I am not looking for permutations, but combinations of specific size.</p>
  
  <p>Thanks a lot : )</p>