Why async function binds name incorrectly from the outer scope?
Why async function binds name incorrectly from the outer scope? Question: Here is an async function generator by iterating a for loop. I expected this closure to respect the names from the outer scope. import asyncio coroutines = [] for param in (1, 3, 5, 7, 9): async def coro(): print(param ** 2) # await …