mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-46624: Defer to 3.12: "Remove deprecated support for non-integer values" (GH-31098)
This commit is contained in:
parent
674ab66ebd
commit
6baa98e538
4 changed files with 94 additions and 50 deletions
|
@ -135,10 +135,15 @@ Functions for integers
|
|||
values. Formerly it used a style like ``int(random()*n)`` which could produce
|
||||
slightly uneven distributions.
|
||||
|
||||
.. versionchanged:: 3.11
|
||||
Automatic conversion of non-integer types is no longer supported.
|
||||
Calls such as ``randrange(10.0)`` and ``randrange(Fraction(10, 1))``
|
||||
now raise a :exc:`TypeError`.
|
||||
.. 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 ``randrange(10.5)``
|
||||
or ``randrange('10')`` will be changed from :exc:`ValueError` to
|
||||
:exc:`TypeError`.
|
||||
|
||||
.. function:: randint(a, b)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue