diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-11-22 05:41:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-22 05:41:53 (GMT) |
commit | bfc6d91c784c428c6f5c706a316cdce9140c4753 (patch) | |
tree | 5aa7fd995c263f2464daa1fa1ae3548d1dbe6e92 | |
parent | 298e57ab569d584bf567c19db68eac3dd87e3693 (diff) | |
download | cpython-bfc6d91c784c428c6f5c706a316cdce9140c4753.zip cpython-bfc6d91c784c428c6f5c706a316cdce9140c4753.tar.gz cpython-bfc6d91c784c428c6f5c706a316cdce9140c4753.tar.bz2 |
[3.12] Fix docstring and var name of itertools recipe (GH-112113) (#112310)
Fix docstring and var name of itertools recipe (GH-112113)
`prepend()` works with arbitrary iterables, not only iterators. In fact,
the example given uses a `list`, which is iterable, but not an iterator.
(cherry picked from commit 6c47eaccfa2550c140a24bc6e520d968731d9689)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
-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 f97e7f7..ebb4ebc 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -798,10 +798,10 @@ which incur interpreter overhead. "Return first n items of the iterable as a list" return list(islice(iterable, n)) - def prepend(value, iterator): - "Prepend a single value in front of an iterator" + def prepend(value, iterable): + "Prepend a single value in front of an iterable" # prepend(1, [2, 3, 4]) --> 1 2 3 4 - return chain([value], iterator) + return chain([value], iterable) def tabulate(function, start=0): "Return function(0), function(1), ..." |