testing array of logicals

Paul Rubin http
Thu Jul 13 01:46:34 EDT 2006


"John Henry" <john106henry at hotmail.com> writes:
> # logflags is an array of logicals
> test=True
> for x in logflags:
>    test = test and x
> print test

    print (False not in map(bool, logflags))

Possibly more "pure" alternative (untested):

    from operator import and_
    print reduce(and_, map(bool, logflags))



More information about the Python-list mailing list