aioplus.awaitify¶
- aioplus.awaitify(func, /, *, executor=None)¶
Make a function asynchronous.
- Parameters:
func (Callable) – A callable to be wrapped for asynchronous execution.
executor (Executor, optional) – An optional
concurrent.futures.Executorto run the function in. IfNone, the default executor is used (usually a thread pool).
- Returns:
An asynchronous callable that, when awaited, runs the original function in the executor.
- Return type:
Callable
Examples
>>> aprint = awaitify(print) >>> await aprint("4 -> 23") 4 -> 23
See also