You are viewing a single comment's thread. Return to all comments →
The lambda in the code is just a single expression - one that returns a tuple. So the docs have it covered really, it is just a single expression.
For example:
lambda x: x * 2 // a simple expression that is an integer
lambda x: (1, 4 * x, 42) // a single expression that is a tuple
lambda x: [x, x * x, 2 * x] // a single expression that is a list
lambda x: (x, x * x, 2 * x) // a single expression that is a tuple
There's a lot in python like this, combining simple language features to make it seem like there's something more complicated going on!
Seems like cookies are disabled on this browser, please enable them to open this website
ginortS
You are viewing a single comment's thread. Return to all comments →
The lambda in the code is just a single expression - one that returns a tuple. So the docs have it covered really, it is just a single expression.
For example:
lambda x: x * 2 // a simple expression that is an integer
lambda x: (1, 4 * x, 42) // a single expression that is a tuple
lambda x: [x, x * x, 2 * x] // a single expression that is a list
lambda x: (x, x * x, 2 * x) // a single expression that is a tuple
There's a lot in python like this, combining simple language features to make it seem like there's something more complicated going on!