Source code: itertools.seq

itertools.combinations[T](pool: Generator[T], r: int)

Return successive r-length combinations of elements in the iterable.

combinations(range(4), 3) –> (0,1,2), (0,1,3), (0,2,3), (1,2,3)

itertools.combinations_with_replacement[T](pool: Generator[T], r: int)

Return successive r-length combinations of elements in the iterable allowing individual elements to have successive repeats.

itertools.islice[T](iterable: Generator[T], start: int, stop: int, step: int)

Make an iterator that returns selected elements from the iterable.

unlike python, seq requires start, stop and step for now. default: start = 0, stop = len(iterable), step = 1

itertools.count(start: float, step: float)

Return a count object whose __next__ method returns consecutive values. default: start = 0.0, step = 1.0

itertools.repeat(object, times: int)

default for times = None, for now seq will use -1

itertools.cycle[T](iterable: Generator[T])


itertools.compress[S, T](data: Generator[S], selectors: Generator[T])

Return data elements corresponding to true selector elements.

Forms a shorter iterator from selected data elements using the selectors to choose the data elements.

itertools.dropwhile[T](predicate: Callable[T, bool], iterable: Generator[T])

Drop items from the iterable while predicate(item) is true.

Afterwards, return every element until the iterable is exhausted.

itertools.takewhile[T](predicate: Callable[T, bool], iterable: Generator[T])

Return successive entries from an iterable as long as the predicate evaluates to true for each entry.

itertools.filterfalse[T](predicate: Callable[T, bool], iterable: Generator[T])

Return those items of iterable for which function(item) is false.

Unlike python, seq will not allow predicate to equal None for now.
if predicate is None:

predicate = bool

itertools.permutations[T](pool: Generator[T], r: Optional[int] = None)

Return successive r-length permutations of elements in the iterable.

itertools.accumulate[T, S](iterable: Generator[T], func: Callable[S, T, S], initial: S)

Return series of accumulated sums (or other binary function results).

Default: func = operator.add, initial = None. For now seq will assume initial is None.


For now chain() == chain.from_iterable()

itertools.starmap(function, iterable)

Return an iterator whose values are returned from the function evaluated with an argument tuple taken from the given sequence.

itertools.groupby[V](iterable : Generator[V], key = Optional[int]())

make an iterator that returns consecutive keys and groups from the iterable


Elements to divide into groups according to the key function.


A function for computing the group category for each element. If the key function is not specified or is None, the element itself is used for grouping.

Deals with only strings for now.

itertools.zip_longest[T](a: Generator[T], b: Generator[T], fillvalue: T)
itertools.product(a, b, equals_ok: bool = True)

Return a Cartesian product of a and b.