Skip to content

(🎁) Allow if expression / conditional base in class def #12445

Open
@KotlinIsland

Description

@KotlinIsland

I have some proxy objects and it's difficult to type them, I want to lie to mypy what the bases are

from typing import TYPE_CHECKING

class A: ...
class B: ...
class C(A if TYPE_CHECKING else B): ...  # error: Invalid base class  [misc]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions