[Python-checkins] r52497 - python/trunk/Doc/lib/libitertools.tex
georg.brandl
python-checkins at python.org
Sat Oct 28 18:04:05 CEST 2006
Author: georg.brandl
Date: Sat Oct 28 18:04:04 2006
New Revision: 52497
Modified:
python/trunk/Doc/lib/libitertools.tex
Log:
Fix nth() itertool recipe.
Modified: python/trunk/Doc/lib/libitertools.tex
==============================================================================
--- python/trunk/Doc/lib/libitertools.tex (original)
+++ python/trunk/Doc/lib/libitertools.tex Sat Oct 28 18:04:04 2006
@@ -474,8 +474,8 @@
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"
More information about the Python-checkins
mailing list