Skip to content

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 5, 2025

@serhiy-storchaka
Copy link
Member Author

There is yet one error message left (for arguments for positional-only parameters passed by keyword), but it is more significant change and I want to discuss it separately.

@serhiy-storchaka serhiy-storchaka changed the title gh-135160: Fix the use of the terms "argument" and "parameter" in error messages for invalid function calls gh-133438: Fix the use of the terms "argument" and "parameter" in error messages for invalid function calls Jun 5, 2025
…in error messages for invalid function calls
@serhiy-storchaka serhiy-storchaka force-pushed the errors-argument-vs-parameter branch from 68ec454 to e19eb6f Compare June 5, 2025 10:36
Py_ssize_t start, end;
int positional = (defcount != -1);
const char *kind = positional ? "positional" : "keyword-only";
const char *kind = positional ? "positional" : "keyword";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keeping keyword-only here, it's correct, no?

>>> def f(*, x): pass
... 
>>> f()
Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    f()
    ~^^
TypeError: f() missing 1 required keyword-only argument: 'x'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Keyword-only" is a qualifier of a parameter. Arguments can be "positional" or "keyword".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants