Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Implement PEP 585 (Generic builtins and __future__.annotations) #7907

Description

@Starwort
  • Are you reporting a bug, or opening a feature request? Reporting a bug
  • Please insert below the code you are checking with mypy,
    or a mock-up repro if the source is private. We would appreciate if you try to simplify your case to a minimal repro.
from __future__ import annotations
from collections import defaultdict

squares: defaultdict[tuple, int] = defaultdict(lambda: 999999)
  • What is the actual behaviour/output? MyPy tells me "defaultdict" is not subscriptable, use "typing.DefaultDict" instead
  • What is the behaviour/output you expect? MyPy ignores the subscript error (and recognises it as equivalent) because of from __future__ import annotations
  • What is the version of mypy and Python you are using? 0.740 on 3.8.0 (Ubuntu 18.04)
  • No additional MyPy flags

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions