]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-102876: remove superfluous parens from itertools.batched recipe (GH-102877)
authorwim glenn <wim.glenn@gmail.com>
Tue, 21 Mar 2023 17:06:18 +0000 (12:06 -0500)
committerGitHub <noreply@github.com>
Tue, 21 Mar 2023 17:06:18 +0000 (12:06 -0500)
remove superfluous parens from itertools.batched recipe

Doc/library/itertools.rst
Lib/test/test_itertools.py

index 78f64ea67e25420e290cc2109c463becf079a259..38bc369d410dda160fff90630007b32ca27565de 100644 (file)
@@ -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
index 7014bc97100cb492edeb2a392fd8544d5c4a5d33..9fe559d4b7eed5dd5c32cc41c74960e5802fe103 100644 (file)
@@ -1846,7 +1846,7 @@ class TestPurePythonRoughEquivalents(unittest.TestCase):
             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(