Created
May 4, 2018 04:49
-
-
Save mypy-play/61dbb5f545d105433f35adcced95bfd7 to your computer and use it in GitHub Desktop.
Shared via mypy Playground
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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