Skip to content

Unsupported operand types for + (List[A] and List[B]) when B extends A #3933

@henryJack

Description

@henryJack

If I have:

Class A:

Class B(A):

Then If I try to add lists of these two objects you get the following mypy error:
error: Unsupported operand types for + (List[A] and List[B])

Any ideas for a work around on this one? Surely the inferred type should be List[Union[A, B]

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions