mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-42450: Minor updates to the itertools recipes (GH-23555)
This commit is contained in:
parent
86684319d3
commit
fc40b3020c
2 changed files with 7 additions and 7 deletions
|
@ -2290,7 +2290,7 @@ Samuele
|
|||
... "Count how many times the predicate is true"
|
||||
... return sum(map(pred, iterable))
|
||||
|
||||
>>> def padnone(iterable):
|
||||
>>> def pad_none(iterable):
|
||||
... "Returns the sequence elements and then returns None indefinitely"
|
||||
... return chain(iterable, repeat(None))
|
||||
|
||||
|
@ -2460,7 +2460,7 @@ True
|
|||
>>> list(pairwise('a'))
|
||||
[]
|
||||
|
||||
>>> list(islice(padnone('abc'), 0, 6))
|
||||
>>> list(islice(pad_none('abc'), 0, 6))
|
||||
['a', 'b', 'c', None, None, None]
|
||||
|
||||
>>> list(ncycles('abc', 3))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue