pytype icon indicating copy to clipboard operation
pytype copied to clipboard

Generator[int] "expected 3 parameters, got 1" even though it is valid acc to Python docs

Open BlackHC opened this issue 7 months ago • 0 comments

[invalid-annotation]  Generator[_T, _T2, _V] expected 3 parameters, got 1

However, the Python documentation clearly says that the following is valid:

def infinite_stream(start: int) -> Generator[int]:
    while True:
        yield start
        start += 1

https://docs.python.org/3/library/typing.html#annotating-generators-and-coroutines

BlackHC avatar May 20 '25 11:05 BlackHC