Re: Map vs. List Comprehensions (was "lint warnings")

2011-02-16 Thread Steven D'Aprano
On Tue, 15 Feb 2011 18:55:50 -0500, Gerald Britton wrote: > So, what's the feeling out there? Go with map and the operators or > stick with the list comps? Stick to whatever feels and reads better at the time. Unless you have profiled your code, and determined that the map or list comp was the

Map vs. List Comprehensions (was "lint warnings")

2011-02-15 Thread Gerald Britton
Generally, I prefer map() over list comprehensions since they are more succinct and run faster for non-trivial examples. However, I've been considering another use case related to functions in the operator module. Here are some examples: [x.method() for x in data] [x[0] for x in data] [x.attr fo