The generally-accepted solution for this task is to set an Event, rather than just returning a Boolean:
def move_to(dest, done_event): ... done_event.set() async def main(): dest = ... done_event = asyncio.Event() create_task(move_to(dest, done_event)) await done_event print('Arrived!') And naturally you could wrap an existing function that returns a Boolean: async def move_to(dest) -> bool: ... async def set_if_success(event, awaitable): result = await awaitable if result: event.set() async def main(): dest = ... done_event = asyncio.Event() create_task(set_if_success(done_event, move_to(dest))) await done_event print('Arrived!') _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/QBR45ENLKZBUFF2M5YOSOJTF4AY7QECS/ Code of Conduct: http://python.org/psf/codeofconduct/