-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Currently mypy doesn't allow indexing fixed-length tuples using a non-literal index. We should probably support this at least for tuples with homogeneous types.
For example, code like this should probably be okay:
t = (1, 3, 7)
for i in range(len(t)):
print(i, t[i])
The example below is actually already valid so rejecting the above code is inconsistent (this works due to how we set the fallback
attribute for tuples to be Tuple[t, ...]
):
t = (1, 2, 3)
for i, x in enumerate(t):
print(i, x)
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong