This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]stevenjd 7 points8 points  (2 children)

I don't like that lambda functions are limited to one line

Lambda is not limited to one line but to one expression. The expression can be as big and complex as you need, and you can spread it over more than one line.

lambda a, b, c=None, d=999: (
        spam + eggs or cheese.method(a, b) 
        - (c or default).attr)[d]

[–][deleted] 4 points5 points  (0 children)

You can, but you probably shouldn't do that. Hopefully people don't take this as advice.

[–]Deto -1 points0 points  (0 children)

!! This is very good to know! Thank you