Thanks, that's an important correction. Given that, run_in_executor is[Guido]> The run_in_executor call is not callback-based -- the confusion probably
> stems from the name of the function argument ('callback'). It actually
> returns a Future representing the result (or error) of an operation, where
> the operation is represented by the function argument. So if you have e.g. a
> function
>
> def factorial(n):
> return 1 if n <= 0 else n*factorial(n-1)
>
> you can run it in an executor from your async(io) code like this:
>
> loop = asyncio.get_event_loop()
> result = yield from loop.run_in_executor(factorial, 100)
>
> (In a PEP 492 coroutine substitute await for yield from.)
the link to blocking calls that I was searching for. And yes, the
"callback" terminology does make this far from obvious, unfortunately.
As does the point at which it's introduced (before futures have been
described) and the fact that it says "this method is a coroutine"
rather than "this method returns a Future"[1].
Paul
[1] I'm still struggling to understand the terminology, so if those
two statements are equivalent, that's not yet obvious to me.