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-133436: Correct error messages that incorrectly use "arguments" by StanFromIreland · Pull Request #133463 · python/cpython Conversation
|
| | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional argument cannot have default value") } | ||
| | '*' (param_no_default | ',') param_maybe_default* a='*' (param_no_default | ',') { | ||
| RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* argument may appear only once") } | ||
| RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* marker may appear only once") } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I liked @picnixz suggestion though there may be an even better word?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
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.
imo, "an asterisk may appear only once" is as clear as possible and will not cause any confusion in terms of terminology
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.
Other error messages refer to / as just / and to * as just *. On other hand, * marker can be confused with bare *. So I think that it is better to use just * here.
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.
There are more:
def f(/, *a, b): pass
^
SyntaxError: at least one argument must precede /
def f(**a, b): pass
^
SyntaxError: arguments cannot follow var-keyword argument
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.
More examples:
def f(/, a, /, b): pass
^
SyntaxError: at least one argument must precede /
def f(a, a): pass
^
SyntaxError: duplicate argument 'a' in function definition
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| | '*' param a='=' { RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "var-positional argument cannot have default value") } | ||
| | '*' (param_no_default | ',') param_maybe_default* a='*' (param_no_default | ',') { | ||
| RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* argument may appear only once") } | ||
| RAISE_SYNTAX_ERROR_KNOWN_LOCATION(a, "* marker may appear only once") } |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Other error messages refer to / as just / and to * as just *. On other hand, * marker can be confused with bare *. So I think that it is better to use just * here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The rest is in #133382, but maybe we can do all in one PR? I suggested two because of semantics, but maybe it's better to do everything at once (in this case, let's use #133382 instead and close the other issue as well) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I suggest to do all in one PR. I do not see semantic difference. There are other error messages that need corrections, see my examples. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I'll close this one and the corresponding issue. We'll work with one issue and one PR instead. |
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.