From 1b70667ca0fec0b810ce4de3551dac3dfb205901 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Tue, 16 Oct 2018 12:04:08 +0200 Subject: [PATCH 1/2] Doc: Fix is_prime --- Doc/library/concurrent.futures.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index 47ca6b38f84eee..bd4ec026a83098 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -257,6 +257,10 @@ ProcessPoolExecutor Example 1099726899285419] def is_prime(n): + if n == 1: + return False + if n == 2: + return True if n % 2 == 0: return False From c61f84a301d027f1069ea8cfdfd0b51940746b11 Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Tue, 16 Oct 2018 16:39:17 +0200 Subject: [PATCH 2/2] Also give False for is_prime(0) and negatives. --- Doc/library/concurrent.futures.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/concurrent.futures.rst b/Doc/library/concurrent.futures.rst index bd4ec026a83098..3890e49f597b77 100644 --- a/Doc/library/concurrent.futures.rst +++ b/Doc/library/concurrent.futures.rst @@ -257,7 +257,7 @@ ProcessPoolExecutor Example 1099726899285419] def is_prime(n): - if n == 1: + if n < 2: return False if n == 2: return True