syntactic sugar for def?

Westley Martínez anikom15 at gmail.com
Thu Sep 29 08:21:21 CEST 2011


On Wed, Sep 28, 2011 at 07:01:11PM -0400, Terry Reedy wrote:
> On 9/28/2011 5:26 PM, Ethan Furman wrote:
> 
> >I don't remember if 'def' is sugar for something besides lambda.
> 
> That is a bit backwards.
>   lambda x: expr(x)
> is syntactic sugar for
>   def <lambda>(x): return expr(x)
>   del <lambda>
> ;-)
> 

lambda is less sugar and more of just a def as an expression.



More information about the Python-list mailing list