summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-02-19 05:34:35 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-02-19 05:34:35 (GMT)
commitf9bce83e71c07ccd7b0ae1a75ea6912f0023b802 (patch)
tree5457b11a6eef3f2efc6f36368ee0eb3d13118193 /Lib/test/test_itertools.py
parent182edaefb515ece87d225494d79ccf7dd35d1ec1 (diff)
downloadcpython-f9bce83e71c07ccd7b0ae1a75ea6912f0023b802.zip
cpython-f9bce83e71c07ccd7b0ae1a75ea6912f0023b802.tar.gz
cpython-f9bce83e71c07ccd7b0ae1a75ea6912f0023b802.tar.bz2
Add some cross-references to the docs. Simplify the python code equivalent for izip(). Supply an optional argument for the nth() recipe.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 81a052b..9eb1389 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1401,9 +1401,9 @@ Samuele
... "Return function(0), function(1), ..."
... return imap(function, count(start))
->>> def nth(iterable, n):
-... "Returns the nth item or None"
-... return next(islice(iterable, n, None), None)
+>>> def nth(iterable, n, default=None):
+... "Returns the nth item or a default value"
+... return next(islice(iterable, n, None), default)
>>> def quantify(iterable, pred=bool):
... "Count how many times the predicate is true"