Python typing documentation includes examples for typing of generator functions. Yield is still a concept I struggle to understand, but I have a scenario where I'm not quite sure, how to properly use typing. The code is a very basic example of my current struggle and shows where my question arises from. If I have two yields in a function, how would I use typing for that function? The documentation on typing gives me no clear answer, my current preference would be, to use Iterator[dict].
def yield_func() -> ?:
A: dict = {}
B: dict = {}
yield A
yield B
I would currently use Iterator[dict] as typing annotations for the given function.