From f40c69cc89dc5933d274ad67db2e46a481619207 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Sun, 14 Nov 2021 23:41:14 +0000 Subject: [PATCH] Simplify stub for iter() As discussed [here](https://github.com/python/typeshed/pull/6292#discussion_r748863110) (cc: @JelleZijlstra) --- stdlib/builtins.pyi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index 44e76da31b6d..9c5685440f0e 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1087,9 +1087,7 @@ def input(__prompt: object = ...) -> str: ... @overload def iter(__iterable: Iterable[_T]) -> Iterator[_T]: ... @overload -def iter(__function: Callable[[], _T | None], __sentinel: None) -> Iterator[_T]: ... -@overload -def iter(__function: Callable[[], _T], __sentinel: object) -> Iterator[_T]: ... +def iter(__function: Callable[[], _T | _S], __sentinel: _S) -> Iterator[_T]: ... # We need recursive types to express the type of the second argument to `isinstance` properly, hence the use of `Any` if sys.version_info >= (3, 10):