[Python-checkins] r52498 - python/branches/release25-maint/Doc/lib/libitertools.tex
georg.brandl
python-checkins at python.org
Sat Oct 28 18:04:08 CEST 2006
Author: georg.brandl
Date: Sat Oct 28 18:04:07 2006
New Revision: 52498
Modified:
python/branches/release25-maint/Doc/lib/libitertools.tex
Log:
Fix nth() itertool recipe.
(backport from rev. 52497)
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 Oct 28 18:04:07 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