Mypy incorrectly complains about assignments to (). The simplest example of this is
This code executes without a problem, but mypy says error: can't assign to ()
A more real world use case might be code like this
(a, b), () = [[1, 2], []]
In this case the assignment to () is a concise way of asserting that the second list is empty.
- What is the actual behavior/output?
error: can't assign to ()
- What is the behavior/output you expect?
No type checking errors
- What are the versions of mypy and Python you are using?
A build from the latest commit as of writing this, 614090b
- What are the mypy flags you are using?
No flags
If this is a change you decide would be good then I believe it could be implemented by removing the the check on line 1930 of mypy/semanal.py and updating the tests.
Mypy incorrectly complains about assignments to
(). The simplest example of this is() = []This code executes without a problem, but mypy says
error: can't assign to ()A more real world use case might be code like this
In this case the assignment to
()is a concise way of asserting that the second list is empty.error: can't assign to ()No type checking errors
A build from the latest commit as of writing this, 614090b
No flags
If this is a change you decide would be good then I believe it could be implemented by removing the the check on line 1930 of
mypy/semanal.pyand updating the tests.