mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-19 10:21:14 +08:00
fix type for itertools.product (#2129)
Fixes #1850. The fix was already applied to Python 2, but the typevar-based solution there leads to "cannot infer value of type variable" in mypy. I used the following script to check: ```python from itertools import product reveal_type(product([1])) reveal_type(product([1], ['x'], [False], [3.0], [(1,)], [('x',)], [{1}], [{1: 2}], repeat=5)) ```
This commit is contained in:
committed by
Guido van Rossum
parent
ced5d61bb6
commit
d2469c0e89
@@ -153,9 +153,10 @@ def product(iter1: Iterable[Any],
|
||||
iter4: Iterable[Any],
|
||||
iter5: Iterable[Any],
|
||||
iter6: Iterable[Any],
|
||||
iter7: Iterable[Any], *iterables: Iterable) -> Iterator[Tuple]: ...
|
||||
iter7: Iterable[Any],
|
||||
*iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
|
||||
@overload
|
||||
def product(*iter: Iterable[_T], repeat: int) -> Iterator[Tuple[_T, ...]]: ...
|
||||
def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ...
|
||||
|
||||
def permutations(iterable: Iterable[_T],
|
||||
r: int = ...) -> Iterator[Sequence[_T]]: ...
|
||||
|
||||
Reference in New Issue
Block a user