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

Pass kwargs to run_sync? #414

Closed
davidbrochart opened this issue Jan 16, 2022 · 4 comments
Closed

Pass kwargs to run_sync? #414

davidbrochart opened this issue Jan 16, 2022 · 4 comments

Comments

@davidbrochart
Copy link
Contributor

It would be nice if to_process.run_sync, to_thread.run_sync, and from_thread.run_sync could accept kwargs.
Is there a reason for not supporting it, or was it just not implemented until now?

@uSpike
Copy link
Contributor

uSpike commented Jan 16, 2022

See discussion in #403, python-trio/trio#470

@davidbrochart
Copy link
Contributor Author

Thanks @uSpike! So do you recommend using a lambda?

run_sync(lambda: my_func('foo', kwarg='bar'))

@uSpike
Copy link
Contributor

uSpike commented Jan 16, 2022

Yep that's the best way in my opinion, otherwise functools.partial.

@davidbrochart
Copy link
Contributor Author

Thanks!

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

2 participants