New submission from Yang Feng <charles...@foxmail.com>:

In documentation of random.getstate(), it says:
“random.getstate()
Return an object capturing the current internal state of the generator. This 
object can be passed to setstate() to restore the state.”

random.getstate() takes 0 argument and return the current setting for the 
weekday to start each week. However, when I give one argument to 
random.getstate(), the interpreter reports the following error:
----------------------------------------------
>>> import random
>>> random.getstate(1)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: getstate() takes 1 positional argument but 2 were given
----------------------------------------------

Here I have two doubts about the reported errors:
1. Is the TypeError correct? This should be an inconsistent argument number 
error. There is nothing to do with Type. 
2. Is the detailed error correct? Doc says random.getstate() takes 0 argument, 
the reported error says getstate() take 1 positional argument. which is 
inconsistent. Besides, I pass one argument to random.getstate(), but the 
reported error says 2 were given.


Environment: Python 3.10, Ubuntu 16.04

----------
assignee: docs@python
components: Documentation
messages: 389535
nosy: CharlesFengY, docs@python
priority: normal
severity: normal
status: open
title: Incorrect argument errors for random.getstate()
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43628>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to