yield_all_unordered_pairs_of_sequence

sequencetools.yield_all_unordered_pairs_of_sequence(sequence)

Yields all unordered pairs of sequence.

>>> list(sequencetools.yield_all_unordered_pairs_of_sequence([1, 2, 3, 4]))
[(1, 2), (1, 3), (1, 4), (2, 3), (2, 4), (3, 4)]

Yields all unordered pairs of length-1 sequence:

>>> list(sequencetools.yield_all_unordered_pairs_of_sequence([1]))
[]

Yields all unordered pairs of empty sequence:

>>> list(sequencetools.yield_all_unordered_pairs_of_sequence([]))
[]

Yields all unordered pairs of sequence with duplicate elements:

>>> list(sequencetools.yield_all_unordered_pairs_of_sequence([1, 1, 1]))
[(1, 1), (1, 1), (1, 1)]

Pairs are tuples instead of sets to accommodate duplicate sequence elements.

Returns generator.