Konrad <kon...@gmail.com> added the comment: I'm afraid I don't have any real-world use cases. Originally, I assumed that dropping the length argument will make the function iterate over *all* combinations, which would enable me to write somehow twisted, one- liner for _inefficiently_ solving knapsack problem.
max((comb for comb in all_combinations(zip(weights, values)) if sum(map(itemgetter(0), comb)) < LIM), key=lambda comb: sum(map(itemgetter(1), comb))) But unfortunately, this is far from being 'compelling'. Regarding other issues you raised: I think it would be pretty clear for the user, that the length of every combination might vary - that's what he asked for. And the length might be computed by summing the lengths counted using given formula, which is (for me at last) still explicit enough. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5048> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com