Issue 8472: itertools.filterfalse() function missing (original) (raw)

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:00 admin set github: 52718
2010-07-04 17:28:58 georg.brandl set status: open -> closedmessages: +
2010-07-04 15:21:38 eric.araujo set nosy: + docs@python
2010-04-20 19:21:07 rhettinger set messages: +
2010-04-20 17:26:43 amyodov set status: closed -> openmessages: +
2010-04-20 17:06:13 ezio.melotti set status: open -> closedassignee: georg.brandlstage: resolvedversions: - Python 2.5nosy: + rhettinger, georg.brandl, ezio.melottimessages: + priority: normalcomponents: + Documentationresolution: fixed
2010-04-20 16:42:52 amyodov set type: behavior
2010-04-20 16:37:34 amyodov create