On Feb 25, 11:17 pm, Paul Rubin <http://[EMAIL PROTECTED]> wrote:
> Arnaud Delobelle <[EMAIL PROTECTED]> writes:
> >     def all(iterable):
> >         for x in iterable:
> >             if not x: return False
> >         return True
>
> from itertools import imap
> def all(iterable):
>    return False not in imap(bool, iterable)

Ok.  In that case, the following is probably faster (in fact for long
iterables it may be equivalent to the builtin all):

from itertools import ifilterfalse

def all(iterable):
    for _ in ifilterfalse(None, iterable):
        return False
    return True


But my point was really about not checking for the version but just
checking for the existence of the name 'all'.

--
Arnaud

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to