combinations_with_repetition¶
- emlib.combinatorics.combinations_with_repetition(seq, size)[source]¶
Yield all combinations of the elements of seq :rtype:
Iterator[tuple[TypeVar(T),...]]items can be repeated: (0, 1, 1) is a valid answer
position is relevant: (0, 1, 2) is not the same as (2, 1, 0)
Note
this is in fact a product of the sequence with itself (see
itertools.product)If position is not relevant, use
itertools.combinations_with_replacement