Commit aabdd548 authored by Georg Brandl's avatar Georg Brandl

Fix nth() itertool recipe.

 (backport from rev. 52497)
parent a35f8e05
......@@ -474,8 +474,8 @@ def iteritems(mapping):
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"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment