Skip to content

Commit 6c1dffe

Browse files
svendJelleZijlstra
authored andcommitted
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.
1 parent a51b480 commit 6c1dffe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

stdlib/2/itertools.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def groupby(iterable: Iterable[_T],
3838
key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
3939

4040
@overload
41-
def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ...
41+
def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...
4242
@overload
4343
def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int],
4444
step: int = ...) -> Iterator[_T]: ...

stdlib/3/itertools.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ def groupby(iterable: Iterable[_T],
4040
key: Callable[[_T], _S]) -> Iterator[Tuple[_S, Iterator[_T]]]: ...
4141

4242
@overload
43-
def islice(iterable: Iterable[_T], stop: int) -> Iterator[_T]: ...
43+
def islice(iterable: Iterable[_T], stop: Optional[int]) -> Iterator[_T]: ...
4444
@overload
45-
def islice(iterable: Iterable[_T], start: int, stop: Optional[int],
45+
def islice(iterable: Iterable[_T], start: Optional[int], stop: Optional[int],
4646
step: int = ...) -> Iterator[_T]: ...
4747

4848
def starmap(func: Callable[..., _S], iterable: Iterable[Iterable[Any]]) -> Iterator[_S]: ...

0 commit comments

Comments
 (0)