Type checking not working as expected?

Answered

This line of code:

s: List[int] = [1, 's', 2]

raises an error with mypy:

error: List item 1 has incompatible type "str"; expected "int"

But no warning on pycharm editor. Is that normal?

Environment: Pycharm Professional 2020.3 on windows 10

 

0
1 comment

Hi,

I filed a bug to our issue tracker https://youtrack.jetbrains.com/issue/PY-46009, please feel free to vote for it and leave comments.

0

Please sign in to leave a comment.