Skip to content

bpo-34235: PyArg_ParseTupleAndKeywords: support required keyword arguments#11834

Closed
msullivan wants to merge 3 commits intopython:mainfrom
msullivan:required-kwonly
Closed

bpo-34235: PyArg_ParseTupleAndKeywords: support required keyword arguments#11834
msullivan wants to merge 3 commits intopython:mainfrom
msullivan:required-kwonly

Conversation

@msullivan
Copy link
Copy Markdown
Contributor

@msullivan msullivan commented Feb 13, 2019

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).

https://bugs.python.org/issue34235

…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*).
@vstinner
Copy link
Copy Markdown
Member

@serhiy-storchaka: Would you mind to review this PR?

@serhiy-storchaka
Copy link
Copy Markdown
Member

I want to try other options first.

@msullivan
Copy link
Copy Markdown
Contributor Author

I'm working on trying out some of the other options that Serhiy suggested, but have been busy

Copy link
Copy Markdown
Member

@iritkatriel iritkatriel left a comment

Choose a reason for hiding this comment

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

This has merge conflicts now, as well as an unresolved discussion.

@bedevere-bot
Copy link
Copy Markdown

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 I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be put in the comfy chair!

@msullivan
Copy link
Copy Markdown
Contributor Author

I can come back to this if there's any interest, but it wasn't clear to me that anybody wanted this but me

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.

8 participants