Skip to content

Better support for defaultdict(lambda) #1205

Closed
@mihneagiurgea

Description

@mihneagiurgea

On this code:

from collections import defaultdict

from typing import Any, Dict, Tuple, Union

class Point(object):
    def __init__(self, x, y):
        # type: (int, int) -> None
        self.x = x
        self.y = y

x = defaultdict(lambda: Point(0, 0))

mypy complains with:

sandbox.py:12: error: Need type annotation for variable

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions