En Tue, 13 Mar 2007 18:16:32 -0300, Arnaud Delobelle <[EMAIL PROTECTED]> escribió:
> On Mar 13, 8:59 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: > [snip] >> def find(self, search): >> search_re = re.compile(search, re.IGNORECASE) >> for result in [self.contacts[name] for name in self.contacts if >> search_re.match(name)]: >> print result > > I do not see how > > for y in [f(x) for x in L if g(x)]: > do stuff with y > > can be preferable to > > for x in L: > if g(x): > do stuff with f(x) > > What can be the benefit of creating a list by comprehension for the > sole purpose of iterating over it? No benefit... -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list