mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
Fix return type of next when default parameter is provided.
**test_next.py**: ```python z = (x*2 for x in range(10)) reveal_type(next(z, None)) ``` Before: ```shell test_next.py:2: error: Revealed type is 'builtins.int*' ``` After: ```shell test_next.py:2: error: Revealed type is 'Union[builtins.int*, builtins.None]' ```
This commit is contained in:
committed by
Łukasz Langa
parent
fd4abe5fc3
commit
41ba734fc2
@@ -743,7 +743,7 @@ def min(iterable: Iterable[_T], key: Callable[[_T], Any] = ..., default: _T = ..
|
||||
@overload
|
||||
def next(i: Iterator[_T]) -> _T: ...
|
||||
@overload
|
||||
def next(i: Iterator[_T], default: _T) -> _T: ...
|
||||
def next(i: Iterator[_T], default: _VT) -> Union[_T, _VT]: ...
|
||||
def oct(i: int) -> str: ... # TODO __index__
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
|
||||
Reference in New Issue
Block a user