-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Multiple isinstance checks in if condition #900
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 |
Yeah, that's right. I would probably go with Tuple[Dict[Node, Type], Dict[Node, Type], int], for the return type, though. Actually, it might be better to be Tuple[Optional[Dict[Node, Type]], Optional[Dict[Node, Type]]] with no kind at all -- if a component is None, then that branch of the conditional cannot happen. If it's not None, then you update the binder using the component. This would avoid the need for the ISINSTANCE_ enum entirely. |
This also squashes a minor weirdness where in order to infer isinstance for resolution further in an and-expr, we were parsing for isinstance in the entire expression! Overall this is pretty self-explanatory. We get rid of the 'kind' stuff and just return a tuple of optional dicts. Fixes python#900.
This also squashes a minor weirdness where in order to infer isinstance for resolution further in an and-expr, we were parsing for isinstance in the entire expression! Overall this is pretty self-explanatory. We get rid of the 'kind' stuff and just return a tuple of optional dicts. Fixes python#900.
This also squashes a minor weirdness where in order to infer isinstance for resolution further in an and-expr, we were parsing for isinstance in the entire expression! Overall this is pretty self-explanatory. We get rid of the 'kind' stuff and just return a tuple of optional dicts. Fixes python#900.
This also squashes a minor weirdness where in order to infer isinstance for resolution further in an and-expr, we were parsing for isinstance in the entire expression! Overall this is pretty self-explanatory. We get rid of the 'kind' stuff and just return a tuple of optional dicts. Fixes python#900.
Mypy should support multiple
isinstance
checks in a condition:This is related to #473.
The text was updated successfully, but these errors were encountered: