New submission from Nnarol :
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.
--
components: Library (Lib)
messages: 412694
nosy: Nnarol
priority: normal
severity: normal
status: open
title: "ValueError: min() arg is an empty sequence" is wrong (builtins.min/max)
type: behavior
versions: Python 3.11
___
Python tracker
<https://bugs.python.org/issue46671>
___
___
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com