I also like that one, both more intuitive than current syntax I think.
On Tue, 28 Jul 2020, 11:25 Guido van Rossum, <[email protected]> wrote: > On Tue, Jul 28, 2020 at 05:42 Thiago Carvalho D' Ávila < > [email protected]> 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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/T35CXY7DQIMSU3HB727VQH36B7MP3MD4/ Code of Conduct: http://python.org/psf/codeofconduct/
