What is the most efficient way to test for False in a list?

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Mon Jul 9 13:16:50 CEST 2007


Paul Rubin wrote:
> lex <alexander.somma at gmail.com> writes:

>> list = [1, True, True, False, False, True]
>> status = True
>> for each in list:
>>     status = status and each
>> 
>> but what is your best way to test for for False in a list?
> 
> status = all(list)

Am I mistaken, or is this no identity test for False at all?

Regards,


Björn

-- 
BOFH excuse #317:

Internet exceeded Luser level, please wait until a luser logs off
before attempting to log back on.




More information about the Python-list mailing list