From: Raymond Hettinger Date: Sat, 14 Jul 2007 11:31:35 +0000 (+0000) Subject: Backport 56345 X-Git-Tag: v2.5.2c1~237 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f4d9caed03a51b7d84912214d8cc255176b3ec08;p=python Backport 56345 --- diff --git a/Doc/lib/libitertools.tex b/Doc/lib/libitertools.tex index f39cde6f0d..964bd50672 100644 --- a/Doc/lib/libitertools.tex +++ b/Doc/lib/libitertools.tex @@ -117,7 +117,7 @@ by functions or loops that truncate the stream. Make an iterator that drops elements from the iterable as long as the predicate is true; afterwards, returns every element. Note, the iterator does not produce \emph{any} output until the predicate - is true, so it may have a lengthy start-up time. Equivalent to: + first becomes false, so it may have a lengthy start-up time. Equivalent to: \begin{verbatim} def dropwhile(predicate, iterable): @@ -474,8 +474,8 @@ def iteritems(mapping): return izip(mapping.iterkeys(), mapping.itervalues()) def nth(iterable, n): - "Returns the nth item or raise IndexError" - return list(islice(iterable, n, n+1))[0] + "Returns the nth item or raise StopIteration" + return islice(iterable, n, None).next() def all(seq, pred=None): "Returns True if pred(x) is true for every element in the iterable"