Skip to content

Use positional-only parameters for some special methods #108635

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

Closed
serhiy-storchaka opened this issue Aug 29, 2023 · 1 comment
Closed

Use positional-only parameters for some special methods #108635

serhiy-storchaka opened this issue Aug 29, 2023 · 1 comment
Labels
topic-argument-clinic type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Aug 29, 2023

Feature or enhancement

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

No response

Proposal:

Most special methods (double underscored from both sizes) are only called with positional arguments. But some implementations forgot to add / in Argument Clinic description. It makes the code unnecessary complex and prevent using the efficient limited C API for it (Argument Clinic does not yet fully support the limited C API for keyword parameters).

We can just add missed /. No deprecation period is needed as these functions were not purposed to be used with keyword arguments.

Linked PRs

@serhiy-storchaka
Copy link
Member Author

They should have positional-only parameters:

typevar.__typing_subst__($self, /, arg)
paramspec.__typing_subst__($self, /, arg)
paramspec.__typing_prepare_subst__($self, /, alias, args)
typevartuple.__typing_subst__($self, /, arg)
typevartuple.__typing_prepare_subst__($self, /, alias, args)
winreg.HKEYType.__exit__($self, /, exc_type, exc_value, traceback)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-argument-clinic type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant