{ } Raw JSON

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, optional

Upper bound, exclusive. Defaults to 5.

Yields

: int

Successive integers starting at 0.

Examples

list(simple_generator(3))

See also

Patti.iter_items

A generator method on Patti.

async_counter

The async def equivalent.

fibonacci

A stateful generator over the same element type.

Aliases

  • papyri.examples.simple_generator