On Thu, Oct 28, 2021 at 3:21 PM S Pradeep Kumar <gohanpra@gmail.com> wrote:
Option 1 sounds good to me too.

Okay, let's go with that.
 
If we go with shorthand, then the data type representing it could remain `Callable`. Shorthand is just syntactic sugar for Callable. That would make it easier to reason about runtime behavior such as `f = (int) -> str`, because it would be equivalent to `f = Callable[[int], str]`. In Python versions with the new syntax, the `repr` for Callable would be `(int) -> str` and, in older versions, it would remain `typing.Callable[[int], str]`.

I think it will have to be a new implementation (in C), since it's not a good idea to have a built-in operation (which this certainly will be) return a type defined in a .py file. We did this for list[int] and int|str too; the types for that can be imported from the types (not typing!) module, under the names GenericAlias and UnionType. So perhaps types.CallableType?

--
--Guido van Rossum (python.org/~guido)