Skip to content
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

Keyword-only arguments #975

Open
CHrlS98 opened this issue Apr 17, 2024 · 0 comments
Open

Keyword-only arguments #975

CHrlS98 opened this issue Apr 17, 2024 · 0 comments

Comments

@CHrlS98
Copy link
Contributor

CHrlS98 commented Apr 17, 2024

Keyword-only arguments https://peps.python.org/pep-3102/ could help make the code more robust. Basically, it forces the user to write the keyword for optional keyword arguments when calling a function.

Example
Function declaration:

def function(a, b, *, c=something, d=anything)

Function call:

my_a = ...
my_b = ...
my_c = ...
my_d = ...

# valid
out = function(my_a, my_b, c=my_c, d=my_d)

# invalid
out = function(my_a, my_b, my_c, my_d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant