
June 19, 2009
3:45 p.m.
On Fri, Jun 19, 2009 at 7:34 AM, Tal Einat<taleinat@gmail.com> wrote:
Just using [f(x) for x in nums if f(x) > 0] is the most readable and obvious option.
I would often prefer to break it into two steps: temp = (f(x) for x in nums) results = [e for e in temp if e>0] Others will dislike the extra line and temp var, which is one reason it isn't among the several solutions previously suggested. Are these differences big enough (or the solutions obscure enough) that the variation is itself a cost of the current situation? -jJ