5 ms·
That's trivial: result = yourfunc() if inspect.iscoroutine(result): result = asyncio.run(result) If I have code like that, it's at one place pe
by 1337shadow 6y ago
That's trivial:
result = yourfunc()
if inspect.iscoroutine(result):
result = asyncio.run(result)
If I have code like that, it's at one place per library, didn't need to encapsulate it in a maybe_await function.