class typing.Generator(Iterator[T_co], Generic[T_co, T_contra, V_co])
A generator can be annotated by the generic type Generator[YieldType, SendType, ReturnType]. For example:
def echo_round() -> Generator[int, float, str]:
sent = yield 0
while sent >= 0:
sent = yield round(sent)
return 'Done'
Note that unlike many other generics in the typing module, the SendType of Generator behaves contravariantly, not covariantly or invariantly.
If your generator will only yiel