-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugmypy got something wrongmypy got something wrong
Description
Bug Report
Suppose we have the follow code:
from typing import Any
x: Any = [1, 2, 3]
sorted([0, 2, 1], key=lambda i: x[i])
With mypy 0.790
, I get an error:
$ mypy --warn-return-any scratch.py
scratch.py:4: error: Returning Any from function declared to return "_SupportsLessThan"
Found 1 error in 1 file (checked 1 source file)
With mypy 0.782
, this passes:
$ mypy --warn-return-any scratch.py
Success: no issues found in 1 source file
I'm not actually sure that this is a bug or whether this is an intended feature -- I could see it either way. On one hand, this is technically a case where we are returning any, so warning on this follows the flag name. OTOH though, lambdas are often used for small things where it'd be syntactically cumbersome to add cast
s.
Your Environment
- Mypy version used: 0.790
- Mypy command-line flags:
--warn-return-any
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: Python 3.6
- Operating system and version: Linux
PhilipTrauner, danyeaw, domanchi, mplanchard, andrew-ang and 12 more
Metadata
Metadata
Assignees
Labels
bugmypy got something wrongmypy got something wrong