From 6c1dffed58c93228b2b62361e2fe8fb1d5172b40 Mon Sep 17 00:00:00 2001 From: Svend Sorensen Date: Tue, 10 Apr 2018 20:55:06 -0700 Subject: [PATCH] Make islice start and stop parameters optional (#2031) From the documentation [1]: "If start is None, then iteration starts at zero." [1] https://docs.python.org/3/library/itertools.html#itertools.islice. PR #1603 made this change for Python 2. --- stdlib/2/itertools.pyi | 2 +- stdlib/3/itertools.pyi | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/stdlib/2/itertools.pyi b/stdlib/2/itertools.pyi index 6038a67e8..487a6e5d6 100644 --- a/stdlib/2/itertools.pyi +++ b/stdlib/2/itertools.pyi @@ -38,7 +38,7 @@ def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... @overload -def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ... +def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ... @overload def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], step: int = ...) -> Iterator[_T]: ... diff --git a/stdlib/3/itertools.pyi b/stdlib/3/itertools.pyi index 6421163ff..51a2ab374 100644 --- a/stdlib/3/itertools.pyi +++ b/stdlib/3/itertools.pyi @@ -40,9 +40,9 @@ def groupby(iterable: Iterable[_T], key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ... @overload -def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ... +def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ... @overload -def islice(iterable: Iterable[_T], start: int, stop: Optional[int], +def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int], step: int = ...) -> Iterator[_T]: ... def starmap(func: Callable[..., _S], iterable: Iterable[Iterable[Any]]) -> Iterator[_S]: ...