Skip to content
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion stdlib/2/itertools.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ _T1 = TypeVar('_T1')
_T2 = TypeVar('_T2')
_T3 = TypeVar('_T3')
_T4 = TypeVar('_T4')
_T5 = TypeVar('_T5')

@overload
def imap(func: Callable[[_T1], _S], iter1: Iterable[_T1]) -> Iterator[_S]: ...
Expand All @@ -71,7 +72,13 @@ def izip(iter1: Iterable[_T1], iter2: Iterable[_T2],
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4]]: ... # TODO more than four iterables
_T3, _T4]]: ...
@overload
def izip(iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3],
iter4: Iterable[_T4], iter5: Iterable[_T5]) -> Iterator[Tuple[_T1, _T2,
_T3, _T4, _T5]]: ...
# TODO more than five iterables
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add the following:

def izip(*iter: Iterable) -> Iterator[tuple]

?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I see you already commented on that. Feel free to do the explicit version for as many arguments as you see fit, but the list of signatures should finish with the general case, even if it's less precise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, adding 6-ary variant and n-ary fallback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the fallback again, that didn't work in Python3.5 (see the more recent Travis failures).


def izip_longest(*p: Iterable[Any],
fillvalue: Any = ...) -> Iterator[Any]: ...

Expand Down