8000 Minor code clean-up for the factor() recipe (GH-108114) · python/cpython@6db39b1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 6db39b1

Browse files
authored
Minor code clean-up for the factor() recipe (GH-108114)
1 parent 9bb576c commit 6db39b1

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

Doc/library/itertools.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,9 +1048,7 @@ The following recipes have a more mathematical flavor:
10481048
# factor(1_000_000_000_000_007) --> 47 59 360620266859
10491049
# factor(1_000_000_000_000_403) --> 1000000000000403
10501050
for prime in sieve(math.isqrt(n) + 1):
1051-
while True:
1052-
if n % prime:
1053-
break
1051+
while not n % prime:
10541052
yield prime
10551053
n //= prime
10561054
if n == 1:

0 commit comments

Comments
 (0)
0