from typing import cast, List o: object = [1] x = cast(List[int], o) # OK y = cast(List[str], o) # OK (cast performs no actual runtime check)