[Python-checkins] bpo-40465: Document random module changes in 3.11 What's new (#31818)

serhiy-storchaka webhook-mailer at python.org
Thu Mar 24 09:23:24 EDT 2022


https://github.com/python/cpython/commit/12c0012cf97d21bc637056983ede0eaf4c0d9c33
commit: 12c0012cf97d21bc637056983ede0eaf4c0d9c33
branch: main
author: Tomáš Hrnčiar <thrnciar at redhat.com>
committer: serhiy-storchaka <storchaka at gmail.com>
date: 2022-03-24T15:22:58+02:00
summary:

bpo-40465: Document random module changes in 3.11 What's new (#31818)

files:
M Doc/library/random.rst
M Doc/whatsnew/3.11.rst

diff --git a/Doc/library/random.rst b/Doc/library/random.rst
index 96c6300ea16f5..72881b56a4b18 100644
--- a/Doc/library/random.rst
+++ b/Doc/library/random.rst
@@ -257,7 +257,7 @@ Functions for sequences
    .. versionchanged:: 3.11
 
       The *population* must be a sequence.  Automatic conversion of sets
-      to lists is longer supported.
+      to lists is no longer supported.
 
 
 .. _real-valued-distributions:
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index fe6c2e24c3d24..b2fdb4852360d 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -705,6 +705,11 @@ Changes in the Python API
   deprecated since Python 3.6.
   (Contributed by Serhiy Storchaka in :issue:`47066`.)
 
+* The *population* parameter of :func:`random.sample` must be a sequence.
+  Automatic conversion of sets to lists is no longer supported. If the sample size
+  is larger than the population size, a :exc:`ValueError` is raised.
+  (Contributed by Raymond Hettinger in :issue:`40465`.)
+
 
 Build Changes
 =============



More information about the Python-checkins mailing list