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

def wrapper(f, *args, wrapper_arg1) vs. def wrapper(f, args, wrapper_arg1) #92

Open
altendky opened this issue Jul 11, 2020 · 1 comment

Comments

@altendky
Copy link
Owner

The parts of Trio that I have seen use a *args approach for forwarded arguments and leave it to the caller to use functools.partial() if they want keyword arguments. So far I've been trying to stick with that but it has the limitation regarding keyword args and also can make typing hinting a bit weird. If instead positional arguments are taken in a sequence and keyword arguments in a map then they are two well defined parameters that can be passed positionally or by keyword and type hinted well.

So, how far should I stick to being Trio-like?

Came up while looking at this and trying to hint it.
https://github.com/altendky/qtrio/pull/90/files#diff-aca67cae4ab3db4c745d891483802bf2R230-R235.

@altendky
Copy link
Owner Author

Discussed in python-trio/trio#470.

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