Skip to content

itertools.pyi: Add overload to Python 3#2659

Merged
JelleZijlstra merged 2 commits intopython:masterfrom
utkarsh2102:itertools
Nov 30, 2018
Merged

itertools.pyi: Add overload to Python 3#2659
JelleZijlstra merged 2 commits intopython:masterfrom
utkarsh2102:itertools

Conversation

@utkarsh2102
Copy link
Copy Markdown
Contributor

This adds an overload to Python 3 version which was missing.

Fixes #2561

Comment thread stdlib/3/itertools.pyi Outdated
@@ -97,6 +97,8 @@ def product(iter1: Iterable[Any],
*iterables: Iterable[Any]) -> Iterator[Tuple[Any, ...]]: ...
@overload
def product(*iterables: Iterable[Any], repeat: int) -> Iterator[Tuple[Any, ...]]: ...
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does just adding = ... to repeat here work? I feel like this and the next overload would be overlapping.

Copy link
Copy Markdown
Contributor Author

@utkarsh2102 utkarsh2102 Nov 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So should I add the repeat: int = ... and remove the next overload, @JelleZijlstra?
Yeah, seems fine. Gonna give it a try,

@srittau
Copy link
Copy Markdown
Collaborator

srittau commented Nov 30, 2018

Unfortunately we lose the information that an empty tuple is returned when no iterables are passed in, but this is probably the best we can do.

@JelleZijlstra JelleZijlstra merged commit 9f9d15e into python:master Nov 30, 2018
@utkarsh2102 utkarsh2102 deleted the itertools branch December 1, 2018 00:12
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

itertools.product with no arguments support

3 participants