python / python/cpython

The doc of `itertools.filterfalse()` shows `predicate` argument but the docstring shows `function` argument

Open
#138,186 5 comments 0 reactions 1 assignee View on GitHub

@rhettinger is already working on this.

Since Aug 28, 2025.

docs
Dominant language
Python
Stars
77.2k
Forks
35.9k
PR merge metrics
PR metrics pending

Description

The doc of itertools.filterfalse() shows predicate argument as shown below:

itertools.filterfalse(predicate, iterable)

But the docstring of itertools.filterfalse() shows function argument instead of predicate argument as shown below:

from itertools import filterfalse

print(help(filterfalse))
# class filterfalse(builtins.object)
#  |  filterfalse(function, iterable, /)
# ...

So the docstring of itertools.filterfalse() should show predicate argument instead of function argument for consistency as shown below:

from itertools import filterfalse

print(help(filterfalse))
# class filterfalse(builtins.object)
#  |  filterfalse(predicate, iterable, /)
# ...

In addition, both the doc and docstring of itertools.takewhile() properly show predicate argument as shown below:

itertools.takewhile(predicate, iterable)

from itertools import takewhile

print(help(takewhile))
# class takewhile(builtins.object)
#  |  takewhile(predicate, iterable, /)
#  ...

And, both the doc and docstring of itertools.dropwhile() properly show predicate argument as shown below:

itertools.dropwhile(predicate, iterable)

from itertools import dropwhile

print(help(dropwhile))
# class dropwhile(builtins.object)
#  |  dropwhile(predicate, iterable, /)
# ...
Linked PRs
  • gh-144451

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.