Alfons Nonell-Canals <alfons.non... at upf.edu> wrote: > finally I've solved it using a "combinatorics" library which allows to > do this kind of things. If you're using a version of Python > 2.6 you might find that itertools.combinations does what you want without requiring the additional code.