This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author konryd
Recipients ezio.melotti, konryd, mark.dickinson, rhettinger
Date 2009-01-25.10:57:38
SpamBayes Score 1.6358888e-05
Marked as misclassified No
Message-id <1232881060.65.0.315176775336.issue5048@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2009-01-25 10:57:40konrydsetrecipients: + konryd, rhettinger, mark.dickinson, ezio.melotti
2009-01-25 10:57:40konrydsetmessageid: <1232881060.65.0.315176775336.issue5048@psf.upfronthosting.co.za>
2009-01-25 10:57:39konrydlinkissue5048 messages
2009-01-25 10:57:38konrydcreate