diff Lib/test/test_itertools.py @ 51320:aa2eb0f242ff

Minor doc fixes.
author Raymond Hettinger <python@rcn.com>
date Wed, 04 Feb 2009 19:45:13 +0000
parents fc51026abde6
children b0db109089c9
line wrap: on
line diff
--- a/Lib/test/test_itertools.py	Wed Feb 04 11:41:45 2009 +0000
+++ b/Lib/test/test_itertools.py	Wed Feb 04 19:45:13 2009 +0000
@@ -1371,8 +1371,8 @@
 ...     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 @@
 [0, 2, 4, 6]
 
 >>> nth('abcde', 3)
-['d']
+'d'
+
+>>> nth('abcde', 9) is None
+True
 
 >>> quantify(range(99), lambda x: x%2==0)
 50