[EMAIL PROTECTED] wrote: > For the list [1,2,3,4], I'm looking for the following for k = 2: > > [[1,2], [3,4]] > [[1,3], [2,4]] > [[1,4], [2,3]]
That's not what you asked for the first time. You said you wanted "m non-empty, disjoint subsets", but the subsets above are clearly not all disjoint; only those on the same line are. It sounds like what you really want is the "powerset of non-empty, disjoint partitions of size k". -- http://mail.python.org/mailman/listinfo/python-list