summaryrefslogtreecommitdiff
path: root/Lib/test/test_itertools.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-02-04 10:52:32 +0000
committerRaymond Hettinger <python@rcn.com>2009-02-04 10:52:32 +0000
commitd507afdc81115b800e3dc72d5e7285453dce8b38 (patch)
treedb3f0e866262d63956f5469619c4e5df368a1fe9 /Lib/test/test_itertools.py
parentfd4c872726e650f1e43c4eed4fa7e7e326b3fee6 (diff)
downloadcpython-git-d507afdc81115b800e3dc72d5e7285453dce8b38.tar.gz
Minor doc fixups.
Diffstat (limited to 'Lib/test/test_itertools.py')
-rw-r--r--Lib/test/test_itertools.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 1ba43f7d18..b79f70f2f4 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1352,8 +1352,8 @@ Samuele
... return imap(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"
@@ -1448,7 +1448,10 @@ perform as purported.
[0, 2, 4, 6]
>>> nth('abcde', 3)
-['d']
+'d'
+
+>>> nth('abcde', 9) is None
+True
>>> quantify(xrange(99), lambda x: x%2==0)
50