Skip to content

Commit c4673f0

Browse files
committed
Apply review comments
1 parent 5e02ef8 commit c4673f0

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Doc/library/random.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Bookkeeping functions
112112
:meth:`randrange` to handle arbitrarily large ranges.
113113

114114
.. versionchanged:: 3.9
115-
This method now accepts ``0`` for *k*.
115+
This method now accepts zero for *k*.
116116

117117

118118
Functions for integers

Lib/random.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def randint(self, a, b):
261261
def _randbelow_with_getrandbits(self, n):
262262
"Return a random int in the range [0,n). Raises ValueError if n==0."
263263

264-
if n == 0:
264+
if not n:
265265
raise ValueError("Boundary cannot be zero")
266266
getrandbits = self.getrandbits
267267
k = n.bit_length() # don't use (n-1) here because n can be 1

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy