-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Weird behavior with Optional[List[<smth>]] as classmethod return type and value produced from Any as part of that list #7612
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
This is a weird one and comes from a bunch of weird interactions and tradeoffs in the design space for Any types and type binding. I believe that this is not a bug, though the interactions here are weird.
To complicated matters even further, case 3 will work if you write the test as |
Closing as this works as designed. Changing the mypy behavior is not totally out of the question, but this would at least need more justification and analysis. |
from the further discussion it seems what the real root cause of the problem is different behavior between
is it considered to be a bug and if so, is it reported already? |
That seems new, but I missed it when reading the discussion. Could you create an issue about that problem in particular? |
created: #7696 |
Are you reporting a bug, or opening a feature request?
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.
without that error, i think the right error should be what 'Any' type doesn't have '.split()' method
But important to note what Class1 and Class2 not causing any mypy warnings, while Class3 does: it seems to me what all 3 of them have the same problem so should be handled with the same result.
Do you see the same issue after installing mypy from Git master?
none of them
The text was updated successfully, but these errors were encountered: