Skip to content

Commit f2ea124

Browse files
authored
random: explicitly mention int for seed (#7916)
#7906 (comment) I felt this better documents how seed is used in practice Co-authored-by: hauntsaninja <>
1 parent 1220a99 commit f2ea124

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

stdlib/random.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,10 @@ class Random(_random.Random):
6767
VERSION: ClassVar[int]
6868
def __init__(self, x: Any = ...) -> None: ...
6969
# Using other `seed` types is deprecated since 3.9 and removed in 3.11
70+
# Ignore Y041, since random.seed doesn't treat int like a float subtype. Having an explicit
71+
# int better documents conventional usage of random.seed.
7072
if sys.version_info >= (3, 9):
71-
def seed(self, a: float | str | bytes | bytearray | None = ..., version: int = ...) -> None: ... # type: ignore[override]
73+
def seed(self, a: int | float | str | bytes | bytearray | None = ..., version: int = ...) -> None: ... # type: ignore[override] # noqa: Y041
7274
else:
7375
def seed(self, a: Any = ..., version: int = ...) -> None: ...
7476

0 commit comments

Comments
 (0)