On 14 Mar 2006 04:23:55 -0800,
[EMAIL PROTECTED] wrote:

> Hello,
> Does python have andmap and ormap:

> andmap((lambda t: boolean(t)),L)

> gives True if boolean(t) is True for all t in L and False otherwise?
> And

> ormap((lambda t: boolean(t)),L)

> gives True if boolean(t) is True for some t in L and False otherwise?

import operator
reduce( L, operator.and_ ) # andmap
reduce( L, operator.or_ ) # ormap

> One can use a list comprehension like

[ ... ]

> Is this good enough?

If it works, and works correctly, then it's good enough.

Regards,
Dan

-- 
Dan Sommers
<http://www.tombstonezero.net/dan/>
"I wish people would die in alphabetical order." -- My wife, the genealogist
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to