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.

Author Nnarol
Recipients Nnarol
Date 2022-02-07.00:22:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1644193346.19.0.843293726099.issue46671@roundup.psfhosted.org>
In-reply-to
Content
Incorrect error message by min_max(): "ValueError: min() arg is an empty sequence" when using the form

    min(iterable, *[, default=obj, key=func]) -> value

and "iterable" is empty, like so:

    min([])

or:

    min(set())

"Sequence" is referred to, even though the function accepts any iterable. E.g. if a different type of collection, such as a set was provided by the user, "sequence" is still printed.

I propose to rephrase the error to "iterable argument is empty", to reflect actual behavior and be in line with the function's documented interface.

"arg" also does not name either any specific variable in C code or a parameter in user-facing documentation. Such an abbreviation is not used by the function's other error messages either, which simply write "argument" or "arguments" in free text, as appropriate in the given context.

Unlike for the error "max expected at least 1 argument, got 0", the above scenario's test does not include matching of the error string. This is probably the reason this was not noticed before. It would be nice to make the test more specific.

The issue seems trivial, but I am not familiar with the CPython project's policy on whether to treat messages of errors, printed on stderr as an interface, in which case, the change would be backwards-incompatible.
Definitely a decision to be made.
History
Date User Action Args
2022-02-07 00:22:26Nnarolsetrecipients: + Nnarol
2022-02-07 00:22:26Nnarolsetmessageid: <1644193346.19.0.843293726099.issue46671@roundup.psfhosted.org>
2022-02-07 00:22:26Nnarollinkissue46671 messages
2022-02-07 00:22:25Nnarolcreate