¡@

Home 

python Programming Glossary: xuniquecombinations

Calculating combinations of length k from a list of length n using recursion

http://stackoverflow.com/questions/8683092/calculating-combinations-of-length-k-from-a-list-of-length-n-using-recursion

combinations selections of a sequence Python recipe def xuniqueCombinations items n if n 0 yield else for i in xrange len items for cc.. n if n 0 yield else for i in xrange len items for cc in xuniqueCombinations items i 1 n 1 yield items i cc def xuniqueCombinations items.. in xuniqueCombinations items i 1 n 1 yield items i cc def xuniqueCombinations items n ... if n 0 yield ... else ... for i in xrange len items..