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
bpo-34235: PyArg_ParseTupleAndKeywords: support required keyword arguments #11834
Conversation
…ments This adds a `@` glyph to the PyArg_ParseTupleAndKeywords that specifies that subsequent arguments are required keyword-only arguments. It must appear after `|` and `$`, and allows functions to take all four combinations of positional/named-only v. required/optional arguments. The restriction that `@` only appear after `|` and `$` have already appeared is because it substantially simplifies the state machine and because `$` already only works properly when `|` is specified (though this is not *checked*).
@serhiy-storchaka: Would you mind to review this PR? |
I want to try other options first. |
I'm working on trying out some of the other options that Serhiy suggested, but have been busy |
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase And if you don't make the requested changes, you will be put in the comfy chair! |
I can come back to this if there's any interest, but it wasn't clear to me that anybody wanted this but me |
This adds a
@
glyph to the PyArg_ParseTupleAndKeywords thatspecifies that subsequent arguments are required keyword-only
arguments. It must appear after
|
and$
, and allows functions totake all four combinations of positional/named-only
v. required/optional arguments.
The restriction that
@
only appear after|
and$
have alreadyappeared is because it substantially simplifies the state machine and
because
$
already only works properly when|
is specified (thoughthis is not checked).
https://bugs.python.org/issue34235