1# mypy 2# You can run this file through mypy and it passes the checks. 3# You can also use it in pylang. 4# 5# The way this works is as follows: 6# - the "typing" module is mocked by the pylang compiler so that 7# importing from it is a no-op (so src/parser.py), and 8# - function annotations are not defined, since that potentially 9# involves running code defined in typing at runtime, which 10# can't work. 11 12from typing import Iterator 13 14 15def fib(n: int) -> Iterator[int]: 16 a, b = 0, 1 17 while a < n: 18 yield a 19 a, b = b, a + b 20 21