From mypy's point of view l1 + l2 is OK. But returning l1 + l2 isn't OK. Why? I'm using Python 3.11 and mypy 1.16. def test() -> list[str | int]: l1: list[str | int] l2: list[int] l1 + l2 # OK return l1 + l2 # error: Unsupported operand types for + ("list[str | int]" and "list[int]") [operator] Continue reading...