bundles / papyri 0.0.10 / papyri / examples / async_counter
function
papyri.examples:async_counter
source: /papyri/examples.py :550
Signature
async def async_counter ( n : int = 3 ) → AsyncIterator[int] Summary
Async generator yielding 0, 1, ..., n - 1.
Extended Summary
This is an async def with a yield inside its body, which makes it an inspect.isasyncgenfunction. Compare with simple_generator (plain generator) and async_fetch (plain coroutine function without yield).
Parameters
n: int, optionalUpper bound, exclusive. Defaults to
3.
Yields
: intSuccessive integers starting at
0.
See also
- Patti.aiter_items
Async generator method on
Patti.- async_fetch
Plain async coroutine (no
yield).- simple_generator
Synchronous generator equivalent.
Aliases
-
papyri.examples.async_counter