3 ms·
> As long as the lambda is limited to single expressions, map and filter are pretty much useless Not really. It is not too difficult to actually define a name
by evgen 18y ago
> As long as the lambda is limited to single expressions, map and filter are pretty much useless
Not really. It is not too difficult to actually define a named function and the code usually ends up being easier to read/understand so that lack of multi-line lambdas is not a serious problem. Additionally, now that map and filter return iterators they are a bit more flexible than they used to be. OTOH, if you are using map and filter in your python code you should probably take a close look at what you are attempting to accomplish and see if a generator expression might do the job better.