Skip to content

Latest commit

 

History

History
306 lines (220 loc) · 6.43 KB

api.rst

File metadata and controls

306 lines (220 loc) · 6.43 KB

API Reference

more_itertools

Grouping

These tools yield groups of items from a source iterable.


New itertools

chunked

ichunked

chunked_even

sliced

constrained_batches(iterable, max_size, max_count=None, get_len=len, strict=True)

distribute

divide

split_at

split_before

split_after

split_into

split_when

bucket

unzip


Itertools recipes

batched

grouper

partition

transpose

Lookahead and lookback

These tools peek at an iterable's values without advancing it.


New itertools

spy

peekable

seekable

Windowing

These tools yield windows of items from an iterable.


New itertools

windowed

substrings

substrings_indexes

stagger

windowed_complete


Itertools recipes

pairwise

triplewise

sliding_window

subslices

Augmenting

These tools yield items from an iterable, plus additional data.


New itertools

count_cycle

intersperse

padded

mark_ends

repeat_each

repeat_last

adjacent

groupby_transform


Itertools recipes

padnone

pad_none

ncycles

Combining

These tools combine multiple iterables.


New itertools

collapse

interleave

interleave_longest

interleave_evenly

partial_product

sort_together

value_chain

zip_offset(*iterables, offsets, longest=False, fillvalue=None)

zip_equal

zip_broadcast(*objects, scalar_types=(str, bytes), strict=False)


Itertools recipes

dotproduct

convolve

flatten

roundrobin

prepend

Summarizing

These tools return summarized or aggregated data from an iterable.


New itertools

ilen

unique_to_each

sample(iterable, k=1, weights=None)

consecutive_groups(iterable, ordering=lambda x: x)

run_length

map_reduce

exactly_n(iterable, n, predicate=bool)

is_sorted

all_unique

minmax(iterable, *[, key, default])

minmax(arg1, arg2, *args[, key])

iequals


Itertools recipes

all_equal

first_true

quantify(iterable, pred=bool)

Selecting

These tools yield certain items from an iterable.


New itertools

islice_extended(iterable, start, stop[, step])

first(iterable[, default])

last(iterable[, default])

one(iterable, too_short=ValueError, too_long=ValueError)

only(iterable, default=None, too_long=ValueError)

strictly_n(iterable, too_short=None, too_long=None)

strip

lstrip

rstrip

filter_except

map_except

nth_or_last(iterable, n[, default])

unique_in_window

duplicates_everseen

duplicates_justseen

longest_common_prefix

takewhile_inclusive


Itertools recipes

nth

before_and_after

take

tail

unique_everseen

unique_justseen

Combinatorics

These tools yield combinatorial arrangements of items from iterables.


New itertools

distinct_permutations

distinct_combinations

nth_combination_with_replacement

circular_shifts

partitions

set_partitions

product_index

combination_index

permutation_index

combination_with_replacement_index

gray_product

outer_product


Itertools recipes

powerset

random_product

random_permutation

random_combination

random_combination_with_replacement

nth_product

nth_permutation

nth_combination

Wrapping

These tools provide wrappers to smooth working with objects that produce or consume iterables.


New itertools

always_iterable

always_reversible

countable

consumer

with_iter

callback_iter


Itertools recipes

iter_except

Others

New itertools

locate(iterable, pred=bool, window_size=None)

rlocate(iterable, pred=bool, window_size=None)

replace

numeric_range(stop)

numeric_range(start, stop[, step])

side_effect

iterate

difference(iterable, func=operator.sub, *, initial=None)

make_decorator

SequenceView

time_limited

map_if(iterable, pred, func, func_else=lambda x: x)


Itertools recipes

iter_index

consume

tabulate

repeatfunc

polynomial_from_roots

polynomial_eval

polynomial_derivative

sieve

factor

matmul

sum_of_squares