mirror of
https://github.com/python/cpython.git
synced 2025-11-24 20:30:18 +00:00
bpo-40465: Deprecate the optional argument to random.shuffle(). (#19867)
This commit is contained in:
parent
766352320f
commit
190fac99c5
4 changed files with 10 additions and 1 deletions
|
|
@ -321,6 +321,10 @@ class Random(_random.Random):
|
|||
j = randbelow(i+1)
|
||||
x[i], x[j] = x[j], x[i]
|
||||
else:
|
||||
_warn('The *random* parameter to shuffle() has been deprecated\n'
|
||||
'since Python 3.9 and will be removed in a subsequent '
|
||||
'version.',
|
||||
DeprecationWarning, 2)
|
||||
_int = int
|
||||
for i in reversed(range(1, len(x))):
|
||||
# pick an element in x[:i+1] with which to exchange x[i]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue