On 23 Sep 2010 03:54:52 GMT Seebs <usenet-nos...@seebs.net> wrote: > On 2010-09-23, Steven D'Aprano <steve-remove-t...@cybersource.com.au> > wrote: > [snip] > > I don't see anyone bitching about: > > > for x in seq: > > if x: > > f(x) > > > vs > > > [f(x) for x in seq if x] > > In my case, that's because I only ran into that syntax about an hour > and a half ago. I have the same basic objection to it. If it were: > > [for x in seq: if x: f(x)] > > I'd find it substantially easier to understand. > > I don't generally like constructs where important structural > information comes late in the construct. [snip]
I think that is precisely the reason that the elements of the list come *first* in the list comprehension expression. The foremost idea of list comprehensions is "build a list", while the idea of a for-loop is "iterate over something". /W -- INVALID? DE! -- http://mail.python.org/mailman/listinfo/python-list