summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-02-19 05:38:53 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-02-19 05:38:53 (GMT)
commit5894c2b5481a4776b57ff0d52fa62a08dc644761 (patch)
treea60dd613876fed70dc4460a631024a086912b570 /Lib/test
parent3e96e231fb196b392d9eca7cc70b0d8f8ed578ed (diff)
downloadcpython-5894c2b5481a4776b57ff0d52fa62a08dc644761.zip
cpython-5894c2b5481a4776b57ff0d52fa62a08dc644761.tar.gz
cpython-5894c2b5481a4776b57ff0d52fa62a08dc644761.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')
-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 91939e2..d297848 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1200,9 +1200,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"