]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] Backport docstring improvement from 3.12 (#98288)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Sat, 15 Oct 2022 18:11:04 +0000 (13:11 -0500)
committerGitHub <noreply@github.com>
Sat, 15 Oct 2022 18:11:04 +0000 (13:11 -0500)
Backport docstring improvement from 3.12

Lib/random.py

index 1f3530e880fce2faa338376673790c7733cc6a27..f94616e048c554a5c0f92d543386b159d6f76a1b 100644 (file)
@@ -282,10 +282,10 @@ class Random(_random.Random):
     ## -------------------- integer methods  -------------------
 
     def randrange(self, start, stop=None, step=_ONE):
-        """Choose a random item from range(start, stop[, step]).
+        """Choose a random item from range(stop) or range(start, stop[, step]).
 
-        This fixes the problem with randint() which includes the
-        endpoint; in Python this is usually not what you want.
+        Roughly equivalent to ``choice(range(start, stop, step))`` but
+        supports arbitrarily large ranges and is optimized for common cases.
 
         """