[Python-checkins] python/dist/src/Lib/test test_itertools.py, 1.37,
1.38
rhettinger at users.sourceforge.net
rhettinger at users.sourceforge.net
Fri Mar 11 23:17:33 CET 2005
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1726/Lib/test
Modified Files:
test_itertools.py
Log Message:
Revised the itertools quantifier recipes to match the performance of the
new builtins.
Index: test_itertools.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_itertools.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- test_itertools.py 5 Dec 2004 09:25:49 -0000 1.37
+++ test_itertools.py 11 Mar 2005 22:17:30 -0000 1.38
@@ -799,26 +799,26 @@
... "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):
More information about the Python-checkins
mailing list