We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mypy does not correctly infer the type of in the following example i: int | None = 42 i's type is int | None
i: int | None = 42
when splitting declaration and assignment it works i.e:
i: int | None i = 42
i's type is int
i: int | None = 42 makes for nicer code.
To Reproduce
i: int | None = 42 i = i + 1
Expected Behavior Should be accepted by mypy
Actual Behavior
inone_test.py:2: error: Unsupported operand types for + ("None" and "int") [operator] none_test.py:2: note: Left operand is of type "int | None"
Your Environment
mypy.ini
The text was updated successfully, but these errors were encountered:
Duplicate of #2008
(there's consensus mypy should change this and it's a trivial change to make, but it exposes some bugs in the binder)
Sorry, something went wrong.
No branches or pull requests
Mypy does not correctly infer the type of in the following example
i: int | None = 42
i's type is int | None
when splitting declaration and assignment it works i.e:
i's type is int
i: int | None = 42
makes for nicer code.
To Reproduce
Expected Behavior
Should be accepted by mypy
Actual Behavior
inone_test.py:2: error: Unsupported operand types for + ("None" and "int") [operator]
none_test.py:2: note: Left operand is of type "int | None"
Your Environment
mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: