-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-2-low
Description
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.
NeilGirdhar
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrongfalse-positivemypy gave an error on correct codemypy gave an error on correct codepriority-2-low