Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Closed
Description
Bug Report
Slot definition in a form of__slots__ = [] raise an error:
ex.py:2: error: Need type annotation for "__slots__" (hint: "__slots__: List[<type>] = ...")To Reproduce
Runmypy on this code:
classA:__slots__= []
Expected Behavior
I expect it to have the same effect as:
classA:__slots__= ()
and to produce no errors.
Moreover,mypy already knows that__slots__ should containstr items only as shown here:
classA:__slots__= [1,2]
Outputs:
ex.py:2: error: List item 0 has incompatible type "int"; expected "str"ex.py:2: error: List item 1 has incompatible type "int"; expected "str"