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?
--
Arnaud
--
http://mail.python.org/mailman/listinfo/python-list