GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||
GeezerVison is showing github.com — gh-107944: Improve error message for function calls with bad keyword arguments by pablogsal · Pull Request #107969 · python/cpython Conversation
|
| Py_DECREF(suggestion_keyword); | ||
| } else { | ||
| _PyErr_Format(tstate, PyExc_TypeError, | ||
| "%U() got an unexpected keyword argument '%S'", |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be a better UX if we included a list with all the possible keywords here? We could special-case it for cases where the list is smaller than X, in order to keep the output to a reasonable size.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I think is better, but on the other hand, it would be a bunch of extra code (joining the list with commas + handling errors) so not sure if is worth the complexity. @rhettinger what do you think? (Note we are referring to the fallback message when we could not find the suggestion either because of errors or because there is nothing close).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
what do you think?
I think what you have now will suffice — only offer a suggestion when a plausible candidate can be found; otherwise, just note that the keyword argument doesn't match.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
0c61952 to
a1e2c35
Compare
…yword arguments Signed-off-by: Pablo Galindo <[email protected]>
|
@lysnikolaou apart from the suggestion is everything else ok with you? (In that case, could you approve the PR?) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Looks good!!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.