
Predict
Safe Between Awaits?
Here's a twist on the fuel tank. This time add has no await between
the read and the write.
import asyncio
async def add(tank):
tank["fuel"] += 1 # no await in here
async def main():
tank = {"fuel": 0}
await asyncio.gather(*(add(tank) for _ in range(100)))
print(tank["fuel"])
asyncio.run(main())