It is documented that itertools.product call with no arguments works fine and it is:
test.py
from itertools import product
print(next(product())) # ()
tested on Python 3.3+ on Linux and on Python 3.0+ on Windows, but running mypy raises error
> mypy test.py
test.py:3: error: All overload variants of "product" require at least one argument
test.py:3: note: Possible overload variants:
test.py:3: note: def [_T1] product(iter1: Iterable[_T1]) -> Iterator[Tuple[_T1]]
test.py:3: note: def [_T1, _T2] product(iter1: Iterable[_T1], iter2: Iterable[_T2]) -> Iterator[Tuple[_T1, _T2]]
test.py:3: note: <6 more similar overloads not shown, out of 8 total overloads>
it happens because there is no support for this kind of call in typeshed, can be fixed by specifying that repeat parameter (added in this PR) has default argument like
@overload
def product(*iterables: Iterable[Any], repeat: int = ...) -> Iterator[Tuple[Any, ...]]: ...
It is documented that
itertools.productcall with no arguments works fine and it is:test.py
tested on Python 3.3+ on Linux and on Python 3.0+ on Windows, but running
mypyraises errorit happens because there is no support for this kind of call in
typeshed, can be fixed by specifying thatrepeatparameter (added in this PR) has default argument like