cantok icon indicating copy to clipboard operation
cantok copied to clipboard

wait() method could distinguish between awaitable and not-awaitable with inspect.isawaitable()

Open kbaikov opened this issue 10 months ago • 0 comments

Perhaps i missing some deeper meaning/use-case but couldn't you just do something like this:

async def await_me_maybe(callback):
    result = callback()
    if inspect.isawaitable(result):
        return await result
    return result

instead of the whole class WaitCoroutineWrapper and its usage?

kbaikov avatar Apr 25 '24 21:04 kbaikov