-
-
Notifications
You must be signed in to change notification settings - Fork 345
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
Lots of people don't know functools.partial; document it better #88
Comments
You can use But yeah, this is intentional, and I don't see how any Python enhancements can help – the basic problem is that we need some way to distinguish between arguments that belong to I don't understand the motivation for having an # Door 1 (now)
trio.run(partial(some_fn, arg1, somearg=blah), clock=...)
# Door 2 (proposed)
trio.run(some_fn, arg1, kwargs=dict(somearg=blah), clock=...) The first line looks nicer to me, though granted you need an extra import. |
I think run and spawn could use an API similar to |
Just renamed this – the sense I'm getting is that |
|
First, if you care I wrote a curio/trio options for IPython's async repl integration (ipython/ipython#10390)
One thing I came across, is that you can't pass kwargs easily to function passed to run/Nursery.spawn:
I think, this is a perfect use for positional only for
async_fn
not to grab a name if you want **kwargs.There was a recent discussion on python idea about positional only.
I don't see any clean way of fixing this, except with an ugly api of the type:
Where option would return a "configured" run.
or allow a args, kwargs (no stars) parameters which are used when
*args
is empty:In my case I worked around with a second function wrapper:
The text was updated successfully, but these errors were encountered: