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

Daniel no at no.no
Mon Jul 9 05:42:12 CEST 2007


On Mon, 09 Jul 2007 06:21:31 +0300, Simon Forman <sajmikins at gmail.com>  
wrote:

>
> On Jul 8, 7:43 pm, lex <alexander.so... at gmail.com> wrote:
>> Of course there is the always the iteration method:
>>
>> 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?
>
>
> False in list
>
>

all() is slightly faster


-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/



More information about the Python-list mailing list