Doesn't this solution have the massive disadvantage that it first generates the entire list of results and then emits them? That is not in the spirit of itertools, and will make the function useless for very large input sets.