Fredrik Lundh wrote: > > lst = [i for i in lst if i != 2] > > (if you have 2.4, try replacing [] with () and see what happens)
The result is a generator with a name ("lst") that's rather misleading in the context. Achieving the same result as the list comprehension, by doing lst = list(i for ... etc etc), appears to be slower. -- http://mail.python.org/mailman/listinfo/python-list