summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-07-13 12:09:41 (GMT)
committerRaymond Hettinger <python@rcn.com>2007-07-13 12:09:41 (GMT)
commit928713c740c282063fc47c0c28f128f3ebd619e9 (patch)
treef0dfd51f3e01558869b0db8d9c2c0709670deb93 /Doc
parent5a3b524e8ed456e52abf80e32fcbd19a50037c8e (diff)
downloadcpython-928713c740c282063fc47c0c28f128f3ebd619e9.zip
cpython-928713c740c282063fc47c0c28f128f3ebd619e9.tar.gz
cpython-928713c740c282063fc47c0c28f128f3ebd619e9.tar.bz2
Correct the docs for takewhile(). Improve the recipe for nth(). Should be backported
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libitertools.tex6
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/lib/libitertools.tex b/Doc/lib/libitertools.tex
index e2f0f0e..362c589 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):
@@ -509,8 +509,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"