KEMBAR78
Binder doesn't understand `if MYPY:` branches are taken unconditionally · Issue #2673 · python/mypy · GitHub
Skip to content

Binder doesn't understand if MYPY: branches are taken unconditionally #2673

@ddfisher

Description

@ddfisher

For example, this code leaves x with type A on the last line, when it should have type B:

class A: pass
class B(A): pass

MYPY = False

def f() -> None:
    x = A()
    if MYPY: assert isinstance(x, B)
    reveal_type(x)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions