Skip to content

Commit 3705dd3

Browse files
authored
[random] Deprecate random parameter in shuffle function (#15226)
Docs: https://docs.python.org/3.10/library/random.html#random.shuffle
1 parent a564787 commit 3705dd3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

stdlib/random.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import sys
33
from _typeshed import SupportsLenAndGetItem
44
from collections.abc import Callable, Iterable, MutableSequence, Sequence, Set as AbstractSet
55
from fractions import Fraction
6-
from typing import Any, ClassVar, NoReturn, TypeVar
7-
from typing_extensions import Self
6+
from typing import Any, ClassVar, NoReturn, TypeVar, overload
7+
from typing_extensions import Self, deprecated
88

99
__all__ = [
1010
"Random",
@@ -67,6 +67,10 @@ class Random(_random.Random):
6767
if sys.version_info >= (3, 11):
6868
def shuffle(self, x: MutableSequence[Any]) -> None: ...
6969
else:
70+
@overload
71+
def shuffle(self, x: MutableSequence[Any]) -> None: ...
72+
@overload
73+
@deprecated("The `random` parameter is deprecated since Python 3.9; removed in Python 3.11.")
7074
def shuffle(self, x: MutableSequence[Any], random: Callable[[], float] | None = None) -> None: ...
7175
if sys.version_info >= (3, 11):
7276
def sample(self, population: Sequence[_T], k: int, *, counts: Iterable[int] | None = None) -> list[_T]: ...

0 commit comments

Comments
 (0)