summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2023-08-18 17:13:58 (GMT)
committerGitHub <noreply@github.com>2023-08-18 17:13:58 (GMT)
commit6db39b1460727e8820b45e5c083e5839af0352aa (patch)
tree4813bfe91349e177c23fcfe5ce2f5d10f0bea62d /Doc/library
parent9bb576cb07b42f34fd882b8502642b024f771c62 (diff)
downloadcpython-6db39b1460727e8820b45e5c083e5839af0352aa.zip
cpython-6db39b1460727e8820b45e5c083e5839af0352aa.tar.gz
cpython-6db39b1460727e8820b45e5c083e5839af0352aa.tar.bz2
Minor code clean-up for the factor() recipe (GH-108114)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/itertools.rst4
1 files changed, 1 insertions, 3 deletions
diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst
index 730736b..d0bb469 100644
--- a/Doc/library/itertools.rst
+++ b/Doc/library/itertools.rst
@@ -1048,9 +1048,7 @@ The following recipes have a more mathematical flavor:
# factor(1_000_000_000_000_007) --> 47 59 360620266859
# factor(1_000_000_000_000_403) --> 1000000000000403
for prime in sieve(math.isqrt(n) + 1):
- while True:
- if n % prime:
- break
+ while not n % prime:
yield prime
n //= prime
if n == 1: