summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2009-02-04 19:45:13 (GMT)
committerRaymond Hettinger <python@rcn.com>2009-02-04 19:45:13 (GMT)
commitd04fa31f7357a4499c630985ebb65391ec6197bf (patch)
treeffdf40fa58e0a984904fe2f821f9d1a2d66b5714 /Doc
parent1c62dc9d73ccb324ce7e15d321f4603894dcd4d3 (diff)
downloadcpython-d04fa31f7357a4499c630985ebb65391ec6197bf.zip
cpython-d04fa31f7357a4499c630985ebb65391ec6197bf.tar.gz
cpython-d04fa31f7357a4499c630985ebb65391ec6197bf.tar.bz2
Minor doc fixes.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/glossary.rst2
-rw-r--r--Doc/library/collections.rst2
-rw-r--r--Doc/library/itertools.rst6
3 files changed, 5 insertions, 5 deletions
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index f8d0e67..34e4858 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -393,7 +393,7 @@ Glossary
also :term:`immutable`.
named tuple
- Any tuple subclass whose indexable elements are also accessible using
+ Any tuple-like class whose indexable elements are also accessible using
named attributes (for example, :func:`time.localtime` returns a
tuple-like object where the *year* is accessible either with an
index such as ``t[0]`` or with a named attribute like ``t.tm_year``).
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 @@ For example::
.. 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 @@ loops that truncate the stream.
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 @@ which incur interpreter overhead.
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"