diff options
author | Raymond Hettinger <python@rcn.com> | 2009-02-19 05:38:53 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-02-19 05:38:53 (GMT) |
commit | 5894c2b5481a4776b57ff0d52fa62a08dc644761 (patch) | |
tree | a60dd613876fed70dc4460a631024a086912b570 /Lib/test | |
parent | 3e96e231fb196b392d9eca7cc70b0d8f8ed578ed (diff) | |
download | cpython-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.py | 6 |
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" |