mirror of
https://github.com/python/cpython.git
synced 2025-11-10 14:31:24 +00:00
gh-102105 Fix wording in filterfalse/quantify/filter (GH-102189)
This commit is contained in:
parent
e5e1c1fabd
commit
81bf10e4f2
2 changed files with 4 additions and 4 deletions
|
|
@ -623,7 +623,7 @@ are always available. They are listed here in alphabetical order.
|
||||||
.. function:: filter(function, iterable)
|
.. function:: filter(function, iterable)
|
||||||
|
|
||||||
Construct an iterator from those elements of *iterable* for which *function*
|
Construct an iterator from those elements of *iterable* for which *function*
|
||||||
returns true. *iterable* may be either a sequence, a container which
|
is true. *iterable* may be either a sequence, a container which
|
||||||
supports iteration, or an iterator. If *function* is ``None``, the identity
|
supports iteration, or an iterator. If *function* is ``None``, the identity
|
||||||
function is assumed, that is, all elements of *iterable* that are false are
|
function is assumed, that is, all elements of *iterable* that are false are
|
||||||
removed.
|
removed.
|
||||||
|
|
@ -634,7 +634,7 @@ are always available. They are listed here in alphabetical order.
|
||||||
``None``.
|
``None``.
|
||||||
|
|
||||||
See :func:`itertools.filterfalse` for the complementary function that returns
|
See :func:`itertools.filterfalse` for the complementary function that returns
|
||||||
elements of *iterable* for which *function* returns false.
|
elements of *iterable* for which *function* is false.
|
||||||
|
|
||||||
|
|
||||||
.. class:: float(x=0.0)
|
.. class:: float(x=0.0)
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ loops that truncate the stream.
|
||||||
.. function:: filterfalse(predicate, iterable)
|
.. function:: filterfalse(predicate, iterable)
|
||||||
|
|
||||||
Make an iterator that filters elements from iterable returning only those for
|
Make an iterator that filters elements from iterable returning only those for
|
||||||
which the predicate is ``False``. If *predicate* is ``None``, return the items
|
which the predicate is false. If *predicate* is ``None``, return the items
|
||||||
that are false. Roughly equivalent to::
|
that are false. Roughly equivalent to::
|
||||||
|
|
||||||
def filterfalse(predicate, iterable):
|
def filterfalse(predicate, iterable):
|
||||||
|
|
@ -831,7 +831,7 @@ which incur interpreter overhead.
|
||||||
return next(g, True) and not next(g, False)
|
return next(g, True) and not next(g, False)
|
||||||
|
|
||||||
def quantify(iterable, pred=bool):
|
def quantify(iterable, pred=bool):
|
||||||
"Count how many times the predicate is true"
|
"Count how many times the predicate is True"
|
||||||
return sum(map(pred, iterable))
|
return sum(map(pred, iterable))
|
||||||
|
|
||||||
def ncycles(iterable, n):
|
def ncycles(iterable, n):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue