From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 22 Nov 2023 05:41:51 +0000 (+0100) Subject: [3.11] Fix docstring and var name of itertools recipe (GH-112113) (#112311) X-Git-Tag: v3.11.7~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=640454fd32c314fd92239c571ae620dabc5aacef;p=thirdparty%2FPython%2Fcpython.git [3.11] Fix docstring and var name of itertools recipe (GH-112113) (#112311) 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 --- diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 2196e53502f5..24e2684496c0 100644 --- a/Doc/library/itertools.rst +++ b/Doc/library/itertools.rst @@ -758,10 +758,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), ..."