Skip to content

Commit

Permalink
Remove uninformative itertools recipe (pythonGH-100253)
Browse files Browse the repository at this point in the history
(cherry picked from commit 8356c14)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
  • Loading branch information
rhettinger authored and miss-islington committed Dec 15, 2022
1 parent cb1001c commit 87f1874
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions Doc/library/itertools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -790,10 +790,6 @@ which incur interpreter overhead.
"Count how many times the predicate is true"
return sum(map(pred, iterable))

def pad_none(iterable):
"Returns the sequence elements and then returns None indefinitely."
return chain(iterable, repeat(None))

def ncycles(iterable, n):
"Returns the sequence elements n times"
return chain.from_iterable(repeat(tuple(iterable), n))
Expand Down Expand Up @@ -1163,9 +1159,6 @@ which incur interpreter overhead.
>>> take(5, map(int, repeatfunc(random.random)))
[0, 0, 0, 0, 0]

>>> list(islice(pad_none('abc'), 0, 6))
['a', 'b', 'c', None, None, None]

>>> list(ncycles('abc', 3))
['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']

Expand Down

0 comments on commit 87f1874

Please sign in to comment.