Skip to content

make itertools.product more precise - #1393

Merged
JelleZijlstra merged 3 commits into
masterfrom
itertools
Jun 13, 2017
Merged

JelleZijlstra merged 3 commits into
masterfrom
itertools

Conversation

@matthiaskramm

Copy link
Copy Markdown
Contributor

This fixes typechecking of code like e.g.

import itertools
itertools.product([1], [u""])

which currently reports a type error.

@JelleZijlstra
JelleZijlstra merged commit ed6dc17 into master Jun 13, 2017
@JelleZijlstra
JelleZijlstra deleted the itertools branch June 13, 2017 03:10
Comment thread stdlib/2/itertools.pyi

# TODO: Return type should be Iterator[Tuple[..]], but unknown tuple shape.
# Iterator[Sequence[_T]] loses this type information.
def product(*p: Iterable[_T], repeat: int = ...) -> Iterator[Sequence[_T]]: ...

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The repeat argument was lost?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My bad. For some reason, I was under the impression that "repeat" doesn't actually exist, on Python 2. I'll send out a PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

gvanrossum pushed a commit that referenced this pull request Jun 14, 2017
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.

3 participants