[Python-Dev] Re: Function Prototypes

2021-12-23 Thread asleep . cult
> Just to be clear, by "function prototype", do you mean what PEP 677 > calls a Callable Type? A "function prototype" would be a concrete type that exists alongside the function type. The objects would hold the arguments, defaults, annotations and name of a function. > What sort of implications

[Python-Dev] Re: Function Prototypes

2021-12-23 Thread asleep . cult
Hello and thank you for the much needed feedback. One thing that you must consider is that function prototypes have a few implications beyond typing but it seems like you're only looking at it as a tool for type hinting. The interpreter will create a function prototype object regardless of if you

[Python-Dev] Function Prototypes

2021-12-23 Thread asleep . cult
gt; list[int]: ... import ctypes @ctypes.CFUNCTYPE def f(x: int) -> bool I have since taken it upon myself to implement this in a fork of cpython: https://github.com/asleep-cult/cpython To remain consistent with function definitions, I have also added an alternative lambda syntax that allows

[Python-Dev] Re: RFC on Callable Syntax PEP

2021-12-20 Thread asleep . cult
My proposal wasn't to make the body optional based on the presence of a decorator, but rather to return a "function prototype" iff the body does not exist (I probably should have made my made my own reply instead of piggybacking on his proposal). I also mentioned some form of expression to

[Python-Dev] Re: RFC on Callable Syntax PEP

2021-12-20 Thread asleep . cult
This is such a great idea that I think it deserves its own PEP (to compete with this one?) Let me explain. PEP 677 was created for the sole purpose of replacing typing.Callable, but there are still some other areas where function metadata is required. What if we instead introduced a function