I am writing a program in Python, and I realized that a problem I need to solve requires me, given a set `S`

with `n`

elements (|S|=n), to test a function on all possible subsets of a certain order `m`

(i.e. with *m* 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.

I am on my way to write a solution of the form:

```
def findsubsets(S, m):
subsets = set([])
...
return subsets
```

But knowing Python I expected a solution to be already there.

What is the best way to accomplish this?

`scipy.misc.comb(S, m)`

gives the number of subsets you will get. You should eventually make a check before you execute your code as the number of m-sized subsets of S gets very big very fast.