-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate the optional *random* argument to random.shuffle() #84645
Comments
shuffle(x, random=None) ⟼ shuffle(x) AFAICT, no one ever uses the optional parameter, nor would they have a valid reason to do so. It is an ancient API oddity and is inconsistent with the other methods in the module. I've long been annoyed by it and would like to see it cleaned-up before I retire ;-) https://docs.python.org/3/library/random.html#random.shuffle |
+1 |
pre-commit uses this to do deterministic shuffling, please don't remove this |
Raymond, could you please add an entry in What's New? |
#75999 adds an entry to What's New in 3.11. |
commit 70a071d
|
Instead, accept any arguments ``random.shuffle`` accepts. Prior to Python 3.11 this was `random` but Python 3.9 deprecated this feature and Python 3.11 removed it. python/cpython#84645 Accepting `*args, **kwargs` makes the signature compatible with whatever Python runtime happens to be in use.
Wow, what a bold statement 🤣. We were using it. Hope you're enjoying retirement. Can someone help me understand the motivation for this? I keep clicking on links trying to figure it out if there was a bug associated with this, but I'm not familiar with the issue tracking here. |
|
The default implementation of So if you passed Keeping a worse algorithm in the code base was a Bad Idea on the face of it, especially given that nobody looking at this knew of anyone actually using the optional argument. In the very early days, Python used the feeble (by current standards) Wichmann–Hill generator. Then there was far more user interest in replacing it with something better, even if slower. For the far fewer users who still care about that, there's a documented way to subclass |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: