-
-
Notifications
You must be signed in to change notification settings - Fork 32k
"ValueError: min() arg is an empty sequence" is wrong (builtins.min/max) #90829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Incorrect error message by min_max(): "ValueError: min() arg is an empty sequence" when using the form
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. |
Hi, I want to solve this issue. How can I start? Thank you! |
This is currently being discussed in #31181 — explicitly linking because the PR predates the Github issues migration. In particular, we don't need more PRs addressing this issue. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: