bundles / papyri 0.0.10 / papyri / examples / simple_generator
function
papyri.examples:simple_generator
source: /papyri/examples.py:450
Signature
def simple_generator(n: int = 5) → Iterator[int]Summary
Yield integers 0, 1, ..., n - 1.
Extended Summary
A minimal synchronous generator used to exercise papyri's handling of generator function signatures (see inspect.isgeneratorfunction).
Parameters
n: int, optionalUpper bound, exclusive. Defaults to
5.
Yields
: intSuccessive integers starting at
0.
Examples
list(simple_generator(3))
✓[0, 1, 2]
See also
- Patti.iter_items
A generator method on
Patti.- async_counter
The
async defequivalent.- fibonacci
A stateful generator over the same element type.
Aliases
papyri.examples.simple_generator