This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: itertools.filterfalse() function missing
Type: behavior Stage: resolved
Components: Documentation Versions: Python 2.7, Python 2.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: amyodov, docs@python, ezio.melotti, georg.brandl, rhettinger
Priority: normal Keywords:

Created on 2010-04-20 16:37 by amyodov, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg103733 - (view) Author: Alexander Myodov (amyodov) Date: 2010-04-20 16:37
The documentation (eg at http://docs.python.org/release/2.6.5/library/functions.html#filter) tells that there should be an itertools.filterfalse() function complementary to builtin filter() function, that returns the list of elements (instead of the iterator over them, as ifilterfalse() does), for which the condition is failed. This function is absent from Python 2.x branch (though obviously is present in 3.x, as all the i* functions are renamed to their non-i* counterparts).
msg103736 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-04-20 17:06
That line has been added first on py3k where the function is called 'itertools.filterfalse' and then ported to 2.x. Most likely the 'i' has been forgotten.
A new filterfalse function can't be added to 2.7 because it's already in beta.
I fixed the link to point to itertools.ifilterfalse() in r80270 and r80271.
Raymond, if you think that sentence should be rephrased, feel free to change it or reopen the issue.
msg103738 - (view) Author: Alexander Myodov (amyodov) Date: 2010-04-20 17:26
In this case, I'd suggest to rephrase it to "See :func:`itertools.ifilterfalse` for the complementary function that returns the iterator over the elements of *iterable* for which *function* returns false.", or even remove this line at all (because, ifilterfalse() is a complement to ifilter() rather than to filter()). But please don't leave this as it is now, as this is still confusing and misleading (filter returns a list, but ifilter and ifilterfalse return an iterator!).
msg103740 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2010-04-20 19:21
Suggestion for Py2.x:

See :func:`itertools.ifilter` and :func:`itertools.ifilterfalse`
for iterator versions of this function, including a variation that filters for elements where the *function* returns *False*).
msg109244 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2010-07-04 17:28
Thanks, applied the suggestion in r82548.
History
Date User Action Args
2022-04-11 14:57:00adminsetgithub: 52718
2010-07-04 17:28:58georg.brandlsetstatus: open -> closed

messages: + msg109244
2010-07-04 15:21:38eric.araujosetnosy: + docs@python
2010-04-20 19:21:07rhettingersetmessages: + msg103740
2010-04-20 17:26:43amyodovsetstatus: closed -> open

messages: + msg103738
2010-04-20 17:06:13ezio.melottisetstatus: open -> closed


assignee: georg.brandl
stage: resolved
versions: - Python 2.5
nosy: + rhettinger, georg.brandl, ezio.melotti
messages: + msg103736
priority: normal
components: + Documentation
resolution: fixed
2010-04-20 16:42:52amyodovsettype: behavior
2010-04-20 16:37:34amyodovcreate