We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Optional[t]
The type of b is incorrectly List[Union[None, int]] instead of List[int] when using --strict-optional:
b
List[Union[None, int]]
List[int]
--strict-optional
from typing import Optional, List a = [] # type: List[Optional[int]] b = [x for x in a if x] reveal_type(b)
Generators and other comprehensions are related (not checked them).
The text was updated successfully, but these errors were encountered:
Rather than being strict optional specific, this is a general problem with Unions:
from typing import Optional, List, Union a = [] # type: List[Union[int, str]] b = [x for x in a if isinstance(x, int)] reveal_type(b) # E: Revealed type is 'builtins.list[Union[builtins.int, builtins.str]]'
Sorry, something went wrong.
Use type information from isinstance checks in comprehensions (#2000)
e2561a8
Fix #1734.
No branches or pull requests
The type of
b
is incorrectlyList[Union[None, int]]
instead ofList[int]
when using--strict-optional
:Generators and other comprehensions are related (not checked them).
The text was updated successfully, but these errors were encountered: