summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2005-03-11 22:17:30 (GMT)
committerRaymond Hettinger <python@rcn.com>2005-03-11 22:17:30 (GMT)
commitf77d0334f30e331f005090723cd1d2955959a8cd (patch)
tree07d272ed0ae008b7f99def61dc05aa45327ae44b /Lib
parent96229b191814556622b575fd320e822f918f355a (diff)
downloadcpython-f77d0334f30e331f005090723cd1d2955959a8cd.zip
cpython-f77d0334f30e331f005090723cd1d2955959a8cd.tar.gz
cpython-f77d0334f30e331f005090723cd1d2955959a8cd.tar.bz2
Revised the itertools quantifier recipes to match the performance of the
new builtins.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_itertools.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index becb3b2..577082b 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -799,26 +799,26 @@ Samuele
... "Returns the nth item"
... return list(islice(iterable, n, n+1))
->>> def all(seq, pred=bool):
-... "Returns True if pred(x) is True for every element in the iterable"
+>>> def all(seq, pred=None):
+... "Returns True if pred(x) is true for every element in the iterable"
... for elem in ifilterfalse(pred, seq):
... return False
... return True
->>> def any(seq, pred=bool):
-... "Returns True if pred(x) is True for at least one element in the iterable"
+>>> 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):
... return True
... return False
->>> def no(seq, pred=bool):
-... "Returns True if pred(x) is False for every element in the iterable"
+>>> def no(seq, pred=None):
+... "Returns True if pred(x) is false for every element in the iterable"
... for elem in ifilter(pred, seq):
... return False
... return True
->>> def quantify(seq, pred=bool):
-... "Count how many times the predicate is True in the sequence"
+>>> def quantify(seq, pred=None):
+... "Count how many times the predicate is true in the sequence"
... return sum(imap(pred, seq))
>>> def padnone(seq):