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.

Title: The optional argument to random.Random() is called "x" not "seed"
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.10
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: boris, mark.dickinson, rhettinger, thatiparthy
Priority: normal Keywords:

Created on 2021-02-01 03:01 by boris, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 24409 boris, 2021-02-01 03:01
Messages (3)
msg386052 - (view) Author: Борис Верховский (boris) * Date: 2021-02-01 03:01
The documentation 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.
msg386058 - (view) Author: Srinivas Reddy Thatiparthy(శ్రీనివాస్ రెడ్డి తాటిపర్తి) (thatiparthy) * Date: 2021-02-01 07:00
I think this was discussed before. If my memory serves me right, Guido kept 'x' as is for backward compatibility reasons. Agreed that was a mistake.
msg386063 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2021-02-01 11:59
> It would be better to rename "x" to "seed" but that's
> not backwards compatible.

As you said, this would be a breaking change, so we can't do it.
Date User Action Args
2022-04-11 14:59:40adminsetgithub: 87255
2021-02-01 11:59:07rhettingersetstatus: open -> closed
resolution: rejected
messages: + msg386063

stage: resolved
2021-02-01 08:35:07serhiy.storchakasetnosy: + rhettinger, mark.dickinson
2021-02-01 07:00:33thatiparthysetnosy: + thatiparthy
messages: + msg386058
2021-02-01 03:01:44boriscreate