diff options
author | Raymond Hettinger <python@rcn.com> | 2008-03-13 00:19:26 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-03-13 00:19:26 +0000 |
commit | a88d4c7b603c7d8b7ce4b0f04017d84b1331060c (patch) | |
tree | 9162cb9c1fac33a32abff34a2c09f352951c2ecf /Doc/library/itertools.rst | |
parent | 3c7018fdac41249f394903be099cfa4f38aa87b3 (diff) | |
download | cpython-a88d4c7b603c7d8b7ce4b0f04017d84b1331060c.tar.gz |
Issue 2186 and 2187. Move filter from itertools to builtins.
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r-- | Doc/library/itertools.rst | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 0d74c598e3..368e40d77c 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -234,21 +234,6 @@ loops that truncate the stream. self.currkey = self.keyfunc(self.currvalue) -.. function:: ifilter(predicate, iterable) - - Make an iterator that filters elements from iterable returning only those for - which the predicate is ``True``. If *predicate* is ``None``, return the items - that are true. This function is the same as the built-in :func:`filter` - function. Equivalent to:: - - def ifilter(predicate, iterable): - if predicate is None: - predicate = bool - for x in iterable: - if predicate(x): - yield x - - .. function:: ifilterfalse(predicate, iterable) Make an iterator that filters elements from iterable returning only those for @@ -606,13 +591,13 @@ which incur interpreter overhead. :: def any(seq, pred=None): "Returns True if pred(x) is true for at least one element in the iterable" - for elem in ifilter(pred, seq): + for elem in filter(pred, seq): return True return False def no(seq, pred=None): "Returns True if pred(x) is false for every element in the iterable" - for elem in ifilter(pred, seq): + for elem in filter(pred, seq): return False return True |