def delegate ( self , fn , * args , * * kwargs ) : callback = functools . partial ( fn , * args , * * kwargs ) coro = self . loop . run_in_executor ( self . subexecutor , callback ) return asyncio . ensure_future ( coro )
python async callbacks with as
Return the given operation as an asyncio future .
def delegate(self, fn, *args, **kwargs):
        """Return the given operation as an asyncio future."""
        callback = functools.partial(fn, *args, **kwargs)
        coro = self.loop.run_in_executor(self.subexecutor, callback)
        return asyncio.ensure_future(coro)