beginner <[EMAIL PROTECTED]> writes: > [f(x) for x in xs] > > I want to skip the point if f(x) raises an exception. How can I do > that without totally removing the list comprehension?
def ff(xs): for x in xs: try: yield f(x) except: pass [x for x in ff(xs)] or alternatively list(ff(xs)) -- http://mail.python.org/mailman/listinfo/python-list