|
|
|
|
|
by Swizec
5653 days ago
|
|
That depends. When you're doing simple translations the list way is much cleaner. ids = [item.id for item in all_items]
Seems much cleaner than ids = map(lambda item: item.id, all_items)
But yes, I agree, when you have to actually perform some less-than-trivial computation on every item of a list, map is much cleaner. |
|
Don't blame map for Python's tax on expression-promotion. ;-)