def concat_tuples(tuple1: Tuple[int, str, float], tuple2: Tuple[str, str, str]) -> Tuple[int, str, float, str, str, str]:
return tuple1 + tuple2
Your second function you just broke out of the type system with Any. Give me a more exact, are you saying Any is a constrained type variable? The only possibility here is this: T = TypeVar('T')
def transform(x: Dict[str, T]) -> Dict[str, Callable[[], T]]:
return {key: lambda : value for key, value in x.items()}
If you want that lambda to do something else you have to constrain T. Constraining T will give me more options in the definition: from numbers import Number
def transform2(x: Dict[str, Number]) -> Dict[str, Callable[[Number], Number]]:
return {key: lambda y: value + y for key, value in x.items()}
def transform3(x: Dict[str, Number]) -> Dict[str, Callable[[], Number]]:
return {key: lambda: value + value for key, value in x.items()}
etc...The thing is because these type checkers are external, anyone can add arbitrary features to them and extend it. Someone can make it to the level of proof checking... eliminating the need for testing in general. Of course the syntax has to support it too.