def func(x: int, y: int, f: (int, int) -> int) -> int: return f(x, y) print(func(1, 4, (x, y) -> x + y)) #Output: 5 I think we can still use the same syntax for both typing.Callable and lambda. It would act like Callable if it comes after the “:” in annotations or after the “->” in function return annotation. After assignment or using it directly as an argument, then it acts like lambda. func: (str, str) -> None = (text1, text2) -> print(text1 + text2) Same syntax, but communicates two different things. I don’t see any problem with this. func: (str, str) -> None = (text1, text2) => print(text1 + text2) is not bad either to be honest.
On 14 Feb 2021, at 12:23 PM, Paul Sokolovsky
wrote: I for one can't parse that (didn't have a morning coffee, but suspect there's a typo/thinko). Btw, I'm not sure about function values, but IMHO, type notation should always use parens for arguments, e.g. "(int) -> int".