Skip to content

Conditional class import #1107

@JukkaL

Description

@JukkaL

It's pretty common to conditionally import a class. Here is a synthetic example:

try:
    from m1 import C
except ImportError:
    from m2 import CC as C

It's not quite obvious how code like the above should be type checked, as m1.C and m2.CC generally don't have identical interfaces.

See also #649.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions