Minor doc fixes.
diff --git a/Doc/library/collections.rst b/Doc/library/collections.rst
index 41b4eba..32cc639 100644
--- a/Doc/library/collections.rst
+++ b/Doc/library/collections.rst
@@ -206,7 +206,7 @@
.. method:: most_common([n])
Return a list of the *n* most common elements and their counts from the
- most common to the least. If *n* not specified, :func:`most_common`
+ most common to the least. If *n* is not specified, :func:`most_common`
returns *all* elements in the counter. Elements with equal counts are
ordered arbitrarily::
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 618cf7d..634b909 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -290,7 +290,7 @@
class groupby(object):
# [k for k, g in groupby('AAAABBBCCDAABBB')] --> A B C D A B
- # [(list(g)) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
+ # [list(g) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
def __init__(self, iterable, key=None):
if key is None:
key = lambda x: x
@@ -591,8 +591,8 @@
return map(function, count(start))
def nth(iterable, n):
- "Returns the nth item or empty list"
- return list(islice(iterable, n, n+1))
+ "Returns the nth item or None"
+ return next(islice(iterable, n, None), None)
def quantify(iterable, pred=bool):
"Count how many times the predicate is true"