Gregory Ewing <greg.ew...@canterbury.ac.nz> writes: > Seems to me you're making life difficult for yourself (and > very inefficient) by insisting on doing the whole computation > with sets. If you want a set as a result, it's easy enough > to construct one from the list at the end.
Yes, but my intent was to show that the pattern -- derived from counting choices -- transfers to the construction of choices, even when sets are used in place of lists. I was responding to what I thought was the idea that you can't work with sets in the same way. And I see I messed a place where I should have used a set but that's just stylistic. Converting the list-of-list version to a set of (frozen) sets is about twice as fast. -- Ben. -- https://mail.python.org/mailman/listinfo/python-list