Page MenuHomeSoftware Heritage
Paste P847

(An Untitled Masterwork)
ActivePublic

Authored by haltode on Nov 3 2020, 9:48 AM.
import asyncio
from typing import AsyncGenerator, AsyncIterator
async def gen() -> AsyncGenerator[int, None]:
for x in [1, 2, 3]:
yield x
async def gen2() -> AsyncIterator[int]:
for x in [1, 2, 3]:
yield x
async def main():
async for x in gen():
print(x)
async for x in gen2():
print(x)
asyncio.run(main())

Event Timeline

haltode created this object in space S1 Public.