[New-bugs-announce] [issue43089] The optional argument to random.Random() is called "x" not "seed"

Борис Верховский report at bugs.python.org
Sun Jan 31 22:01:44 EST 2021


New submission from Борис Верховский <boris.verk at gmail.com>:

The documentation https://docs.python.org/3/library/random.html#random.Random says:

> class random.Random([seed])¶

But in reality the parameter is called "x" not "seed" (CPython 3.9):

>>> import random
>>> random.Random(seed=0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __init__() got an unexpected keyword argument 'seed'
>>> random.Random(x=0)
<random.Random object at 0x20ddc10>

Same goes for random.SystemRandom

It would be better to rename "x" to "seed" but that's not backwards compatible.

----------
components: Library (Lib)
messages: 386052
nosy: boris
priority: normal
pull_requests: 23224
severity: normal
status: open
title: The optional argument to random.Random() is called "x" not "seed"
type: enhancement
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43089>
_______________________________________


More information about the New-bugs-announce mailing list