Summary
I feel like this is probably a dupe of something, but I can't find anything like this. playground
from typing import Any
def f(i: int) -> None:
pass
def g(x: Any) -> None:
if isinstance(x, str):
f(x) # passes?
def h(x: int | str) -> None:
if isinstance(x, str):
f(x) # correctly fails: Expected `int`, found `str`
I'm not aware of any type-system reason f(x) in g should succeed, and it seems to get caught by other type checkers.
Version
f9ba228f6 (playground)
Summary
I feel like this is probably a dupe of something, but I can't find anything like this. playground
I'm not aware of any type-system reason
f(x)ingshould succeed, and it seems to get caught by other type checkers.Version
f9ba228f6 (playground)