This would only work for combinations of identical sets, and also does not seem to work with generated sets, or iterators. Forgetting dice for a moment. Say I have 3 very long files, and i want to generate the combinations of lines in the files. This provides a well known iterator for the example.
file1 = open('foo.txt') file2 = open('bar.txt') file3 = open('baz'.xt') All examples I have seen and all attempts I have written generally do something similar - which is they only iterates through the possible combinations for the last element and do nothing for all other elements. I saw an interesting example that generates a nested function for the given number of sets. While the example still didn't work with generators as input, I think a little tweaking would make it work. This should fulfill my requirements with a rather harsh limit of python's max nesting depth (20?) -- http://mail.python.org/mailman/listinfo/python-list