On Tue, Jul 28, 2020 at 05:42 Thiago Carvalho D' Ávila < thiagocav...@gmail.com> wrote:
> The idea here is to use the same operator already used to type-hint the > return of functions `->` to define the return of a Callable. > > * Current syntax: > > Callable[[ArgumentList], ReturnType] > > eg. > > def x(method: Callable[[int, dict], None]) -> None: > pass > > * Proposed syntax: > > Callable[ArgumentList] -> ReturnType > > eg. > > def x(method: Callable[int, dict] -> None) -> None: > pass > Why not just ‘(int, dict) -> None’? Do you think this is more intuitive? Is it viable? > Definitively more intuitive. With the new PEG parser it *may* be viable. However it may make it harder in the future to introduce ‘(x, y) -> x+y’ as a shorthand for lambda, which has also been proposed. I wouldn’t rush anything. —Guido -- --Guido (mobile)
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/JUHKHWFTOKKC6Y556JVJ4L4ULVEKUQDJ/ Code of Conduct: http://python.org/psf/codeofconduct/