diff options
author | Raymond Hettinger <python@rcn.com> | 2008-03-13 00:19:26 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-03-13 00:19:26 (GMT) |
commit | 17301e9fab311badbbe26a1efcb2decf637b324a (patch) | |
tree | 1326aa6f309cc11fa17b4aee81c26eea77d47e1e /Doc/library/itertools.rst | |
parent | 45832ea4082c6df50021dbeb9a157aad851fdeb8 (diff) | |
download | cpython-17301e9fab311badbbe26a1efcb2decf637b324a.zip cpython-17301e9fab311badbbe26a1efcb2decf637b324a.tar.gz cpython-17301e9fab311badbbe26a1efcb2decf637b324a.tar.bz2 |
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 0d74c59..368e40d 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 |