Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using builtin list as argument to map #10298

Closed
PhilReinhold opened this issue Apr 8, 2021 · 2 comments
Closed

Using builtin list as argument to map #10298

PhilReinhold opened this issue Apr 8, 2021 · 2 comments
Labels
bug mypy got something wrong priority-1-normal

Comments

@PhilReinhold
Copy link

Bug Report

Mypy emits a spurious error when using the python builtin list as the first argument to the python builtin map

To Reproduce

from typing import List

x: List[str] = list(map(str, range(5)))  # works
y: List[List[str]] = list(map(list, x))  # fails
z: List[str] = list("1")  # works

Expected Behavior

I would expect no error. The builtin in list should satisfy the expected type Callable[[str], List[_T]].

(Write what you thought would happen.)

Actual Behavior

running mypy on this yields error: Argument 1 to "map" has incompatible type "Type[List[Any]]"; expected "Callable[[str], List[_T]]"

Your Environment

  • Mypy version used: 0.812
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.7.10
  • Operating system and version: Windows 10
@PhilReinhold PhilReinhold added the bug mypy got something wrong label Apr 8, 2021
@danzat
Copy link

danzat commented May 20, 2021

This looks like a duplicate of #9253

@AlexWaygood
Copy link
Member

This looks like a duplicate of #9253

Agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong priority-1-normal
Projects
None yet
Development

No branches or pull requests

4 participants