[Python-ideas] Using rightarrow "->" for typing annotation of functions

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Apr 25 19:12:45 EDT 2019


Guido van Rossum wrote:
> Also, some groups of people would like to see a more concise notation 
> for lambdas, and maybe they'd want to write
> 
> x = (a, b) -> a + b
> 
> We probably can't have both,

I think we could if we wanted to. In an annotation, -> could be treated
as sugar for Callable[], and in other expressions as sugar for lambda.

-- 
Greg




More information about the Python-ideas mailing list