[Python-checkins] gh-102876: remove superfluous parens from itertools.batched recipe (GH-102877)

rhettinger webhook-mailer at python.org
Tue Mar 21 13:06:34 EDT 2023


https://github.com/python/cpython/commit/4bb1dd3c5c14338c9d9cea5988431c858b3b76e0
commit: 4bb1dd3c5c14338c9d9cea5988431c858b3b76e0
branch: main
author: wim glenn <wim.glenn at gmail.com>
committer: rhettinger <rhettinger at users.noreply.github.com>
date: 2023-03-21T12:06:18-05:00
summary:

gh-102876: remove superfluous parens from itertools.batched recipe (GH-102877)

remove superfluous parens from itertools.batched recipe

files:
M Doc/library/itertools.rst
M Lib/test/test_itertools.py

diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 78f64ea67e25..38bc369d410d 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -195,7 +195,7 @@ loops that truncate the stream.
           if n < 1:
               raise ValueError('n must be at least one')
           it = iter(iterable)
-          while (batch := tuple(islice(it, n))):
+          while batch := tuple(islice(it, n)):
               yield batch
 
    .. versionadded:: 3.12
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py
index 7014bc97100c..9fe559d4b7ee 100644
--- a/Lib/test/test_itertools.py
+++ b/Lib/test/test_itertools.py
@@ -1846,7 +1846,7 @@ def batched_recipe(iterable, n):
             if n < 1:
                 raise ValueError('n must be at least one')
             it = iter(iterable)
-            while (batch := tuple(islice(it, n))):
+            while batch := tuple(islice(it, n)):
                 yield batch
 
         for iterable, n in product(



More information about the Python-checkins mailing list