Currently the examples in the structure section imply a list comprehension is "Better"
# create a concatenated string from 0 to 19 (e.g. "012..1819")
nums = [str(n) for n in range(20)]
print "".join(nums)
but using map is "Best"
# create a concatenated string from 0 to 19 (e.g. "012..1819")
nums = map(str, range(20))
print "".join(nums)
However, the guide doesn't recommend one approach over the other in the style section.
My impression is most people prefer list comprehensions because they are cleaner even if sometimes microscopically slower. See e.g. a discussion on StackOverflow and Google's style guide.
Is it intentional to recommend map over list comprehensions? If yes, we should add this recommendation in the style section for consistency; if not, we should remove the recommendation in the structure section. FWIW, my preference is list comprehensions.
Currently the examples in the structure section imply a list comprehension is "Better"
but using map is "Best"
However, the guide doesn't recommend one approach over the other in the style section.
My impression is most people prefer list comprehensions because they are cleaner even if sometimes microscopically slower. See e.g. a discussion on StackOverflow and Google's style guide.
Is it intentional to recommend
mapover list comprehensions? If yes, we should add this recommendation in the style section for consistency; if not, we should remove the recommendation in the structure section. FWIW, my preference is list comprehensions.