Can this be written more concisely in a functional style

MetalOne jcb at iteris.com
Mon Nov 17 19:48:36 EST 2003


1)
def f(xs):
    for x in xs:
        if test(x): return True
    return False

I know that I can do (2), but it operates on the whole list and the original
may break out early.  I want the efficiency of (1), but the conciseness of (2).

2)
return True in map(test,xs)




More information about the Python-list mailing list