How can I find all the subsets of a set, with exactly n elements?
<p>I am writing a program in Python, and I realized that a problem I need to solve requires me, given a set <em>S</em> with <em>n</em> elements (|S|=n), to test a function on all possible subsets of a certain order <em>m</em> (i.e. with <em>m</em> number of elements). To use the answer to produce a partial solution, and then try again with the next order m=m+1, until m=n.</p>

<p>I am on my way to write a solution of the form:</p>

<pre><code>def findsubsets(S,m):
    subsets=set([])
    ...
    return subsets
</code></pre>

<p>But knowing Python I expected a solution to be already there.</p>

<p>What is the best way to accomplish this?</p>
