python – can lambda have more than one return

Yes, it’s possible. Because an expression such as this at the end of a function:

return a, b

Is equivalent to this:

return (a, b)

And there, you’re really returning a single value: a tuple which happens to have two elements. So it’s ok to have a lambda return a tuple, because it’s a single value:

lambda a, b: (a, b) # here the return is implicit

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)