On Jul 9, 7:39 am, Hrvoje Niksic <[EMAIL PROTECTED]> wrote: > "Diez B. Roggisch" <[EMAIL PROTECTED]> writes: > > > > >>>> 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? > > > You are mistaken. > > all take an iterable and returns if each value of it is true. > > Testing for truth is not the same as an identity test for False. OP's > message doesn't make it clear which one he's looking for. This > illustrates the difference: > > >>> False in [3, 2, 1, 0, -1] > > True # no False here>>> all([3, 2, 1, 0, -1]) > > False # false value present, not necessarily False
I think if you want identity testing, you'll need to code your own; here's a map+lambda way: >>> any(map(lambda _ : _ is False,[3,2,1,0,-1])) False >>> any(map(lambda _ : _ is False,[3,2,1,0,-1,False])) True >>> -- Paul -- http://mail.python.org/mailman/listinfo/python-list