diff options
author | Raymond Hettinger <python@rcn.com> | 2009-02-19 04:45:07 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-02-19 04:45:07 (GMT) |
commit | cdf8ba369ba8a83bbf107f14185626797a6f4a95 (patch) | |
tree | 8015174a2c2d4896bbc4ba79583d93bc5443cc69 /Lib | |
parent | d75fcb4ddfb76b290083982e44b80582ab13aae2 (diff) | |
download | cpython-cdf8ba369ba8a83bbf107f14185626797a6f4a95.zip cpython-cdf8ba369ba8a83bbf107f14185626797a6f4a95.tar.gz cpython-cdf8ba369ba8a83bbf107f14185626797a6f4a95.tar.bz2 |
Add some cross-references to the docs. Simplify the python code equivalent for zip(). Supply an optional argument for the nth() recipe.
Diffstat (limited to 'Lib')
-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 8492484..cf0ca24 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -1419,9 +1419,9 @@ Samuele ... "Return function(0), function(1), ..." ... return map(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" |