andmap and ormap

Fredrik Lundh fredrik at pythonware.com
Tue Mar 14 07:37:00 EST 2006


Felipe Almeida Lessa wrote:

> The problem is that it will evaluate all possibilities needlessly. Try
> (not tested and 2.4-only):

footnote: if you have a recent Python 2.5 build, you can make them even
shorter:

>>> help(any)
any(...)
    any(iterable) -> bool
    Return True if bool(x) is True for any x in the iterable.

>>> help(all)
all(...)
    all(iterable) -> bool
    Return True if bool(x) is True for all values x in the iterable.

</F> 






More information about the Python-list mailing list