{ } Raw JSON

bundles / papyri 0.0.10 / papyri / examples / fibonacci

function

papyri.examples:fibonacci

source: /papyri/examples.py :482

Signature

def   fibonacci ( limit : int )  →  Iterator[int]

Summary

Yield Fibonacci numbers strictly below limit.

Extended Summary

Like simple_generator, this is a plain synchronous generator; the state lives in local variables between yield points.

Parameters

limit : int

Stop yielding once the next term would be >= limit.

Yields

: int

The next Fibonacci number.

Examples

list(fibonacci(20))

See also

async_counter

An async generator yielding integers.

higher_order

Consume the output via a ~collections.abc.Callable.

simple_generator

A simpler counting generator.

Aliases

  • papyri.examples.fibonacci