Skip to content

Multiple isinstance checks in if condition #900

Closed
@JukkaL

Description

@JukkaL

Mypy should support multiple isinstance checks in a condition:

def f(x: A, y: A) -> None:
    if isinstance(x, B) and isinstance(y, B):
        # Types of both x and y should be B here, but currently only x is B
        ...

class A: pass
class B(A): pass

This is related to #473.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions