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 prototype that
allows you to "declare" a "function" without a body.
typing example:
import typing
@typing.Callable
def IntToIntFunc(a: int) -> int
def flat_map(
l: list[int],
func: IntToIntFunc
) -> list[int]:
...
ctypes example:
import ctypes
@ctypes.CFUNCTYPE
def f(x: int) -> bool
But of course this comes with a few issues: should it be an expression and if
so, should the name be optional? How can ParamSpec be handled?
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/XPPZZZWVVW6KRBKYXJKXHPTECRDIOFUE/
Code of Conduct: http://python.org/psf/codeofconduct/