• Home
  • Raw
  • Download

Lines Matching refs:itertools

12 :mod:`itertools` and :mod:`functools`.
640 :func:`itertools.imap` function does the same thing but can handle infinite
641 iterators; it'll be discussed later, in the section on the :mod:`itertools` module.
660 :func:`filter` also has a counterpart in the :mod:`itertools` module,
661 :func:`itertools.ifilter`, that returns an iterator and can therefore handle
662 infinite sequences just as :func:`itertools.imap` can.
665 :mod:`itertools` module because it cumulatively performs an operation on all the
849 The itertools module
852 The :mod:`itertools` module contains a number of commonly-used iterators as well
866 ``itertools.count(n)`` returns an infinite stream of integers, increasing by 1
869 itertools.count() =>
871 itertools.count(10) =>
874 ``itertools.cycle(iter)`` saves a copy of the contents of a provided iterable
878 itertools.cycle([1,2,3,4,5]) =>
881 ``itertools.repeat(elem, [n])`` returns the provided element ``n`` times, or
884 itertools.repeat('abc') =>
886 itertools.repeat('abc', 5) =>
889 ``itertools.chain(iterA, iterB, ...)`` takes an arbitrary number of iterables as
893 itertools.chain(['a', 'b', 'c'], (1, 2, 3)) =>
896 ``itertools.izip(iterA, iterB, ...)`` takes one element from each iterable and
899 itertools.izip(['a', 'b', 'c'], (1, 2, 3)) =>
912 itertools.izip(['a', 'b'], (1, 2, 3)) =>
919 ``itertools.islice(iter, [start], stop, [step])`` returns a stream that's a
926 itertools.islice(range(10), 8) =>
928 itertools.islice(range(10), 2, 8) =>
930 itertools.islice(range(10), 2, 8, 2) =>
933 ``itertools.tee(iter, [n])`` replicates an iterator; it returns ``n``
940 itertools.tee( itertools.count() ) =>
956 ``itertools.imap(f, iterA, iterB, ...)`` returns a stream containing
959 itertools.imap(operator.add, [5, 6, 5], [1, 2, 3]) =>
967 ``itertools.starmap(func, iter)`` assumes that the iterable will return a stream
970 itertools.starmap(os.path.join,
983 ``itertools.ifilter(predicate, iter)`` returns all the elements for which the
989 itertools.ifilter(is_even, itertools.count()) =>
992 ``itertools.ifilterfalse(predicate, iter)`` is the opposite, returning all
995 itertools.ifilterfalse(is_even, itertools.count()) =>
998 ``itertools.takewhile(predicate, iter)`` returns elements for as long as the
1007 itertools.takewhile(less_than_10, itertools.count()) =>
1010 itertools.takewhile(is_even, itertools.count()) =>
1013 ``itertools.dropwhile(predicate, iter)`` discards elements while the predicate
1018 itertools.dropwhile(less_than_10, itertools.count()) =>
1021 itertools.dropwhile(is_even, itertools.count()) =>
1028 The last function I'll discuss, ``itertools.groupby(iter, key_func=None)``, is
1048 itertools.groupby(city_list, get_state) =>
1182 Documentation for the :mod:`itertools` module.
1229 The itertools module
1242 import itertools
1244 slice = itertools.islice(it, 10)