[Python-checkins] r56363 - python/branches/release25-maint/Doc/lib/libitertools.tex

raymond.hettinger python-checkins at python.org
Sat Jul 14 13:31:35 CEST 2007


Author: raymond.hettinger
Date: Sat Jul 14 13:31:35 2007
New Revision: 56363

Modified:
   python/branches/release25-maint/Doc/lib/libitertools.tex
Log:
Backport 56345

Modified: python/branches/release25-maint/Doc/lib/libitertools.tex
==============================================================================
--- python/branches/release25-maint/Doc/lib/libitertools.tex	(original)
+++ python/branches/release25-maint/Doc/lib/libitertools.tex	Sat Jul 14 13:31:35 2007
@@ -117,7 +117,7 @@
   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 @@
     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"


More information about the Python-checkins mailing list