diff options
author | Raymond Hettinger <python@rcn.com> | 2009-02-04 19:45:13 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-02-04 19:45:13 (GMT) |
commit | d04fa31f7357a4499c630985ebb65391ec6197bf (patch) | |
tree | ffdf40fa58e0a984904fe2f821f9d1a2d66b5714 /Lib/test/test_itertools.py | |
parent | 1c62dc9d73ccb324ce7e15d321f4603894dcd4d3 (diff) | |
download | cpython-d04fa31f7357a4499c630985ebb65391ec6197bf.zip cpython-d04fa31f7357a4499c630985ebb65391ec6197bf.tar.gz cpython-d04fa31f7357a4499c630985ebb65391ec6197bf.tar.bz2 |
Minor doc fixes.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r-- | Lib/test/test_itertools.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index f69ad26..50c3402 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -1371,8 +1371,8 @@ Samuele ... return map(function, count(start)) >>> def nth(iterable, n): -... "Returns the nth item or empty list" -... return list(islice(iterable, n, n+1)) +... "Returns the nth item or None" +... return next(islice(iterable, n, None), None) >>> def quantify(iterable, pred=bool): ... "Count how many times the predicate is true" @@ -1469,7 +1469,10 @@ perform as purported. [0, 2, 4, 6] >>> nth('abcde', 3) -['d'] +'d' + +>>> nth('abcde', 9) is None +True >>> quantify(range(99), lambda x: x%2==0) 50 |