En Sun, 05 Aug 2007 06:06:54 -0300, SMERSH009 <[EMAIL PROTECTED]> escribió:
> The only question that remains for me--and this is just for my > knowledge-- what does the "if i" mean in this code snippet? > f = [i.split() for i in d if i] > How is it helpful to leave a dangling "if i"? Why not just f = > [i.split() for i in d]? `if i` means `if i is considered true`. In this case we are talking about strings: "" is false and all other strings are true. So this is a way to say `if i is not the empty string`, effectively filtering out empty lines. Perhaps using more meaningful names for variables makes the code more clear: exploded_lines = [line.split() for line in lines if line] -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list