On May 20, 8:51 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > John Salerno: > >> What does everyone think about this? > > > The Example 2 builds a list, that is then thrown away. It's just a > > waste of memory (and time). > > No, it doesn't. It uses append because it refers to itself in the > if-expression. So the append(c) is needed - and thus the assignment > possible but essentially useless. > > Diez
Yes it does, it build a list of 'None's. And if list.append is concerned, the example given has no use, since: x = [c for c in cs] is essentially the same as x = [] [x.append(c) for c in cs] If, you're talking about other function calls, it might be an abuse or not depending on personal preference. -- http://mail.python.org/mailman/listinfo/python-list