-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
mypy reports unexpected errors in the statement "result = list(map(abspath, x))" #2389
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
Comments
I think it's a weakness of mypy's type inference. def abspath(path: AnyStr) -> AnyStr: ... where You can make your def test1( x : List[str]) -> List[str] :
result = list(map(abspath, x)) # type: List[str]
... |
At first I thought this is a general problem due to the way contexts don't reach back into expressions, but it really does look like the line |
Annotating does not help in all cases, consider:
Playground here, reporting after this SO question. |
Both original example and the example by @sterliakov now work correctly (polymorphic inference strikes again LOL). |
Hi,
I've a function in my code, where mypy reports errors, that I don't understand. A simple example:
This produces the following output (mypy 0.4.5):
Am I doing something wrong? Or is this a problem of mypy?
The text was updated successfully, but these errors were encountered: