-
Notifications
You must be signed in to change notification settings - Fork 3
Python lamba funcion
ghdrako edited this page Jun 27, 2023
·
1 revision
Synax: Gorzej lambda args: expression
tasks.sort(key=lambda x: x['urgency'], reverse=True)
Unlike regular functions, which may return an object, lambda functions don’t return anything. When they do, you get a syntax error:
lambda x: return x * 2
# ERROR: SyntaxError: invalid syntax
Test