diff options
author | Georg Brandl <georg@python.org> | 2006-10-28 16:04:04 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2006-10-28 16:04:04 (GMT) |
commit | 35692a0c0e0875c72c86aa4f027f3893af16018a (patch) | |
tree | 03ddd0d75a229c95c976dde17ce40b4b111a67d4 /Doc | |
parent | 0b679629c6e3ef3d1f0107ed1fd8c09158dfa917 (diff) | |
download | cpython-35692a0c0e0875c72c86aa4f027f3893af16018a.zip cpython-35692a0c0e0875c72c86aa4f027f3893af16018a.tar.gz cpython-35692a0c0e0875c72c86aa4f027f3893af16018a.tar.bz2 |
Fix nth() itertool recipe.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/lib/libitertools.tex | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Doc/lib/libitertools.tex b/Doc/lib/libitertools.tex index 20bbc8d..59fbd98 100644 --- a/Doc/lib/libitertools.tex +++ b/Doc/lib/libitertools.tex @@ -474,8 +474,8 @@ def iteritems(mapping): return izip(mapping.iterkeys(), mapping.itervalues()) def nth(iterable, n): - "Returns the nth item" - return list(islice(iterable, n, n+1)) + "Returns the nth item or raise IndexError" + return list(islice(iterable, n, n+1))[0] def all(seq, pred=None): "Returns True if pred(x) is true for every element in the iterable" |