Skip to content

Instantly share code, notes, and snippets.

@mypy-play
Created March 25, 2019 09:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mypy-play/f51d5c8ddafa0e3d24482beb31edfaa8 to your computer and use it in GitHub Desktop.
Save mypy-play/f51d5c8ddafa0e3d24482beb31edfaa8 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
from typing import Iterator
def fib(n: int) -> Iterator[int]:
a, b = 0, 1
while a < n:
yield a
a, b = b, a + b
fib(10)
fib("10")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment