You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unexpected '...' for homogeneous tuples using builtin list, set (PEP 585) #14707
The same error for tuple was fixed in #10766 but I see now an error "Unexpected" for the builtin types list, set:
To Reproduce
# the snippetl=list[str, ...] # errort=tuple[str, ...] # no errors=set[str, ...] # error
Expected Behavior
No errors
Actual Behavior
test.py:1: error: Unexpected "..." [misc]
test.py:1: error: "list" expects 1 type argument, but 2 given [type-arg]
test.py:5: error: Unexpected "..." [misc]
test.py:5: error: "set" expects 1 type argument, but 2 given [type-arg]
Found 4 errors in 1 file (checked 1 source file)
Your Environment
Mypy version used: 1.0.0
Mypy command-line flags: none
Mypy configuration options from mypy.ini (and other config files): default after installation
PEP 484 specifies the behavior of Tuple. The ... is not allowed in the other type annotations above. It sounds like PyCharm is not in compliance with the typing spec.
Activity
JelleZijlstra commentedon Feb 15, 2023
This is correct.
tupleis special;...is invalid for other types (other than Callable, where it has a different specialized meaning).ibondar-altilan commentedon Feb 16, 2023
Thank you. But the built-in PyCharm linter handles all these types in the same way. Tuple is special for mypy only or it is written in PEP 585?
erictraut commentedon Feb 17, 2023
PEP 484 specifies the behavior of Tuple. The
...is not allowed in the other type annotations above. It sounds like PyCharm is not in compliance with the typing spec.ibondar-altilan commentedon Feb 17, 2023
Yes, I've got that, thanks