This class has async and sync methods (i.e. isHuman):
class Character: def isHuman(self) -> Self: if self.human: return self raise Exception(f'{self.name} is not human') async def hasJob(self) -> Self: await asyncio.sleep(1) return self async def isKnight(self) -> Self: await asyncio.sleep(1) return selfIf all methods were sync, I'd have done:
# Fluent patternjhon = ( Character(...) .isHuman() .hasJob() .isKnight())I know I could do something like:
jhon = Character(...).isHuman()await jhon.hasJob()await jhon.isKnight()But I'm looking for something like this:
jhon = await ( Character(...) .isHuman() .hasJob() .isKnight())