Skip to content

mypy confused by defaultdict(list) #815

Closed
@agentydragon

Description

@agentydragon

Source:

from collections import defaultdict
x = defaultdict(list)

Error:

test.py:2: error: Argument 1 to "defaultdict" has incompatible type List[_T]; expected Callable[[], List[_T]]
test.py:2: error: Need type annotation for variable

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions