Datasets:
Download Python/train/3.13/async-generators/modern_06.py from SwashBuckler001/idiombench: direct link, hf CLI and curl.
- Browser
- Download file 382 Bytes
-
https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/async-generators/modern_06.py
- Command line
-
hf download hf://datasets/SwashBuckler001/idiombench/Python/train/3.13/async-generators/modern_06.py
-
curl -L -o modern_06.py https://huggingface.co/datasets/SwashBuckler001/idiombench/resolve/main/Python/train/3.13/async-generators/modern_06.py
382 Bytes
| async def gen(): | |
| await asyncio.sleep(0.1) | |
| v = yield 42 | |
| print(v) | |
| await asyncio.sleep(0.2) | |
| g = gen() | |
| await g.asend(None) # Will return 42 after sleeping | |
| # for 0.1 seconds. | |
| await g.asend('hello') # Will print 'hello' and | |
| # raise StopAsyncIteration | |
| # (after sleeping for 0.2 seconds.) | |