Type annotation for itertools #1207
Replies: 3 comments 2 replies
-
You are attempting to assign a value of type |
Beta Was this translation helpful? Give feedback.
-
Using reveal_locals() in get_pair() gives:
builtins.list[builtins.int] is list[int], but what is the translation of 'itertools.islice[Tuple[builtins.int, builtins.int]] for pair? |
Beta Was this translation helpful? Give feedback.
-
Ok, got a mypy Success with:
Thank-you. What is the significance of the '...' in tuple[int, ...] ? |
Beta Was this translation helpful? Give feedback.
-
This convoluted example produces pairs of integers. The first integer is from a 'number' list and the second is an odd integer using itertools.slice. Once the pairs are produced, the 'number' and matching 'odd' integer lists are extracted using zip(,). The code works but mypy throws the errors shown below:
Beta Was this translation helpful? Give feedback.
All reactions