combinations_with_repetition

emlib.combinatorics.combinations_with_repetition(seq, size)[source]

Yield all combinations of the elements of seq :rtype: Generator[Tuple[TypeVar(T), ...], None, None]

  • 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)