diff options
author | Raymond Hettinger <python@rcn.com> | 2009-02-04 10:52:32 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-02-04 10:52:32 (GMT) |
commit | d507afdc81115b800e3dc72d5e7285453dce8b38 (patch) | |
tree | db3f0e866262d63956f5469619c4e5df368a1fe9 /Doc/library/itertools.rst | |
parent | fd4c872726e650f1e43c4eed4fa7e7e326b3fee6 (diff) | |
download | cpython-d507afdc81115b800e3dc72d5e7285453dce8b38.zip cpython-d507afdc81115b800e3dc72d5e7285453dce8b38.tar.gz cpython-d507afdc81115b800e3dc72d5e7285453dce8b38.tar.bz2 |
Minor doc fixups.
Diffstat (limited to 'Doc/library/itertools.rst')
-rw-r--r-- | Doc/library/itertools.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 78b10c7..240baf0 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -282,7 +282,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 @@ -675,8 +675,8 @@ which incur interpreter overhead. return imap(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" |