There typingis no such function in the module , and most likely this will not happen.
Checking whether an object is an instance of a class that only means “this object was created by the class constructor” is a simple matter of testing some tags.
, "" , :
assert isinstance(foo, Callable[[int], str]), 'Wrong type'
foo (, a lambda), , , .
, List[int], , , .
xs = set(range(10000))
xs.add("a")
xs.pop()
assert isinstance(xs, Set[int]), 'Wrong type'
, , : , foo int. , , , .. , , , :
def foo() -> int:
if "a".startswith("a"):
return 1
return "x"