Can this be written more concisely in a functional style

Georgy Pruss see_signature__ at hotmail.com
Tue Nov 18 02:11:56 EST 2003


Something like
  return any( test, xs )
or
  return xs.any( test )
?

-- 
Georgy Pruss
E^mail: 'ZDAwMTEyMHQwMzMwQGhvdG1haWwuY29t\n'.decode('base64')


"MetalOne" <jcb at iteris.com> wrote in message news:92c59a2c.0311171648.6360213d at posting.google.com...
| 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