Python generatorの型ヒント
Python 3.9からは collections.abc.Generator を使う(typing.Generatorはdeprecated)
typing.Generator にドキュメント充実
Generator[YieldType, SendType, ReturnType]
もしジェネレータが値を返すだけの場合は、 SendType と ReturnType に None を設定してください
代わりに、ジェネレータを Iterable[YieldType] や Iterator[YieldType] という返り値の型でアノテーションをつけることもできます
例:Prime number sieve with generators http://mypy-lang.org/examples.html
IterableでもIteratorでもよい!
https://stackoverflow.com/a/68950564