This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: DeprecationWarning: The *random* parameter to shuffle() has been deprecated since Python 3.9 and will be removed in a subsequent version
Type: Stage: resolved
Components: Versions: Python 3.9
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Kkshitish, iritkatriel
Priority: normal Keywords:

Created on 2021-05-31 08:08 by Kkshitish, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
main.py Kkshitish, 2021-05-31 08:08 This is python Code file
Messages (4)
msg394792 - (view) Author: Kshitish Kumar (Kkshitish) Date: 2021-05-31 08:08
Code:

import random as ran


x = ran.shuffle(10,random=1)

Output:

DeprecationWarning: The *random* parameter to shuffle() has been deprecated since Python 3.9 and will be removed in a subsequent version.

 x = ran.shuffle(10,random=1)
  File "C:\Users\nisha\AppData\Local\Programs\Python\Python39\lib\random.py", line 369, in shuffle
    for i in reversed(range(1, len(x))):
TypeError: object of type 'int' has no len()
msg394793 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-31 08:15
What were you expecting?

The documentation is here:
https://docs.python.org/3/library/random.html
msg394804 - (view) Author: Kshitish Kumar (Kkshitish) Date: 2021-05-31 11:42
I was expecting a proper result from this code. Because If you do same thing in other computer language. You will get a proper answer.
msg394810 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2021-05-31 15:29
If you pass an integer to a function that expects a sequence you get an error message (in most languages).

Please read the documentation.
History
Date User Action Args
2022-04-11 14:59:46adminsetgithub: 88438
2021-05-31 15:29:20iritkatrielsetmessages: + msg394810
2021-05-31 11:42:52Kkshitishsetmessages: + msg394804
2021-05-31 09:45:12steven.dapranosetstatus: open -> closed
resolution: not a bug
stage: resolved
2021-05-31 08:15:24iritkatrielsetnosy: + iritkatriel
messages: + msg394793
2021-05-31 08:08:06Kkshitishcreate