1 2 3 4 5 6 7 8 9 10 11 12 13 14
# run-async # Async function capturing variables from enclosing scope def make_adder(n): async def adder(x): return x + n return adder add_five = make_adder(5) result = await add_five(10) # pyright: ignore assert result == 15