[New-bugs-announce] [issue39200] Inaccurate TypeError message for `range` without argument

Julien Férard report at bugs.python.org
Fri Jan 3 09:27:51 EST 2020


New submission from Julien Férard <julien_ferard at yahoo.fr>:

When passing no argument to `range`, the error message states that (exactly) one argument is expected.

Actual:

    Python 3.9.0a0 (heads/master:d395209653, Jan  3 2020, 11:37:03)
    [GCC 7.4.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> range()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: range expected 1 argument, got 0

Expected message:

    TypeError: range expected at least 1 argument, got 0

(See for instance:

    >>> eval()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: eval expected at least 1 argument, got 0
)

----------
components: Interpreter Core
messages: 359236
nosy: jferard
priority: normal
severity: normal
status: open
title: Inaccurate TypeError message for `range` without argument
type: enhancement
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

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


More information about the New-bugs-announce mailing list