aboutsummaryrefslogtreecommitdiff
path: root/Doc
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2021-01-25 23:02:04 +0200
committerGitHub <noreply@github.com>2021-01-25 23:02:04 +0200
commitf066bd94b9225a5a3c4ade5fc3ff81e3c49b7b32 (patch)
treeb2d22c54e628f087d86e9dfb0330ede92eb4a260 /Doc
parentbpo-42869: Avoid an HTTP redirection. (GH-24174) (diff)
downloadcpython-f066bd94b9225a5a3c4ade5fc3ff81e3c49b7b32.tar.gz
cpython-f066bd94b9225a5a3c4ade5fc3ff81e3c49b7b32.tar.bz2
cpython-f066bd94b9225a5a3c4ade5fc3ff81e3c49b7b32.zip
bpo-37319: Improve documentation, code and tests of randrange. (GH-19112)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/random.rst5
-rw-r--r--Doc/whatsnew/3.10.rst4
2 files changed, 7 insertions, 2 deletions
diff --git a/Doc/library/random.rst b/Doc/library/random.rst
index 07ee0115214..9d85c2b9958 100644
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -141,8 +141,9 @@ Functions for integers
``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`.
+ The exception raised for non-integral values such as ``randrange(10.5)``
+ or ``randrange('10')`` will be changed from :exc:`ValueError` to
+ :exc:`TypeError`.
.. function:: randint(a, b)
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst
index a6c3fbbff91..3026a1ac0e5 100644
--- a/Doc/whatsnew/3.10.rst
+++ b/Doc/whatsnew/3.10.rst
@@ -530,6 +530,10 @@ Deprecated
as appropriate to help identify code which needs updating during
this transition.
+* Non-integer arguments to :func:`random.randrange` are deprecated.
+ The :exc:`ValueError` is deprecated in favor of a :exc:`TypeError`.
+ (Contributed by Serhiy Storchaka and Raymond Hettinger in :issue:`37319`.)
+
* The various ``load_module()`` methods of :mod:`importlib` have been
documented as deprecated since Python 3.6, but will now also trigger
a :exc:`DeprecationWarning`. Use