Map vs list comprehension (hint Guido prefers comprehension) in Python #shorts #python

preview_player
Показать описание
Which should you prefer: map() or list comprehension. I fall in the list comprehension camp. They are easier to understand and read. However, I do use map when I have a list of lists and want to avoid nested list comprehension.
Рекомендации по теме
Комментарии
Автор

You can use lambdas for map instead of using a declared function for one-liners like that a lot of the time.

hhill
visit shbcf.ru