summaryrefslogtreecommitdiffstats
path: root/Doc/library
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2020-12-28 19:10:34 (GMT)
committerGitHub <noreply@github.com>2020-12-28 19:10:34 (GMT)
commita9621bb301dba44494e81edc00e3a3b62c96af26 (patch)
treeb5b79c36977d682803b3b7fcbc35b156f18d4809 /Doc/library
parent1031f23fc3aed6760785bf0f8290bd2b2cce41c2 (diff)
downloadcpython-a9621bb301dba44494e81edc00e3a3b62c96af26.zip
cpython-a9621bb301dba44494e81edc00e3a3b62c96af26.tar.gz
cpython-a9621bb301dba44494e81edc00e3a3b62c96af26.tar.bz2
bpo-42222: Modernize integer test/conversion in randrange() (#23064)
Diffstat (limited to 'Doc/library')
-rw-r--r--Doc/library/random.rst9
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/library/random.rst b/Doc/library/random.rst
index fa5c74b..07ee011 100644
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -135,6 +135,15 @@ Functions for integers
values. Formerly it used a style like ``int(random()*n)`` which could produce
slightly uneven distributions.
+ .. deprecated:: 3.10
+ The automatic conversion of non-integer types to equivalent integers is
+ deprecated. Currently ``randrange(10.0)`` is losslessly converted to
+ ``randrange(10)``. In the future, this will raise a :exc:`TypeError`.
+
+ .. deprecated:: 3.10
+ The exception raised for non-integral values such as ``range(10.5)``
+ will be changed from :exc:`ValueError` to :exc:`TypeError`.
+
.. function:: randint(a, b)
Return a random integer *N* such that ``a <= N <= b``. Alias for