From 35692a0c0e0875c72c86aa4f027f3893af16018a Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sat, 28 Oct 2006 16:04:04 +0000 Subject: Fix nth() itertool recipe. --- Doc/lib/libitertools.tex | 4 ++-- 1 file 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" -- cgit v0.12