PEP 0492 adds new __await__ magic method. Object that implements this method becomes future-like object and can be awaited using await. It
__await__
await
To await inside a __await__ function, use the following code:
async def new_sleep(): await asyncio.sleep(1) class Waiting: def __await__(self): yield from new_sleep().__await__() print('first sleep') yield from new_sleep().__await__() print('second sleep') return 'done'