From: Raymond Hettinger Date: Fri, 18 Aug 2023 17:13:58 +0000 (-0500) Subject: Minor code clean-up for the factor() recipe (GH-108114) X-Git-Tag: v3.13.0a1~915 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6db39b1460727e8820b45e5c083e5839af0352aa;p=thirdparty%2FPython%2Fcpython.git Minor code clean-up for the factor() recipe (GH-108114) --- diff --git a/Doc/library/itertools.rst b/Doc/library/itertools.rst index 730736bbb59e..d0bb46969701 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: