Skip to content

Commit

Permalink
zip is an Iterator, not an Iterable.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 605392927
  • Loading branch information
Solumin authored and rchen152 committed Feb 9, 2024
1 parent 41fd1d4 commit 17ba2a9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pytype/stubs/builtins/builtins.pytd
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def sum(iterable: Iterable[_T], start: _T) -> _T: ...
def vars(*args, **kwargs) -> dict[str, Any]: ...

if sys.version_info >= (3, 10):
class zip(Iterable[_S]):
class zip(Iterator[_S]):
@overload
def __new__(cls, *, strict: bool = ...) -> zip[nothing]: ...
@overload
Expand All @@ -187,8 +187,9 @@ if sys.version_info >= (3, 10):
def __new__(cls, seq1: Iterable[_T], seq2: Iterable[_T2], *, strict: bool = ...) -> zip[Tuple[_T, _T2]]: ...
@overload
def __new__(cls, seq1, seq2, seq3, *seqs: Iterable, strict: bool = ...) -> zip[tuple]: ...
def __iter__(self) -> Self: ...
else:
class zip(Iterable[_S]):
class zip(Iterator[_S]):
@overload
def __new__(cls) -> zip[nothing]: ...
@overload
Expand All @@ -203,6 +204,7 @@ else:
def __new__(cls, seq1: Iterable[_T], seq2: Iterable[_T2]) -> zip[Tuple[_T, _T2]]: ...
@overload
def __new__(cls, seq1, seq2, seq3, *seqs: Iterable) -> zip[tuple]: ...
def __iter__(self) -> Self: ...

# Keyword constants cannot be assigned here; they are defined in the parser.
# False: bool = ...
Expand Down

0 comments on commit 17ba2a9

Please sign in to comment.