parts[i&1].add(item)
i >>= 1
for b in partitions(parts[1]):
yield (parts[0],) + b
def partitions(set_):
After Change
if tuples:
for partition in partitions1( seq ):
// Convert the partition into a list of sorted tuples.
partition = map(tuple, map(sorted, partition))
// Convert the partition into a sorted tuple of sorted tuples.
// Sort by smallest parts first, then lexicographically.
partition = tuple(sorted(partition, cmp=len_cmp))
yield partition
else:
for partition in partitions1( seq ):
partition = frozenset( map(frozenset, partition) )