returning True, False or None

Fahri Basegmez fbasegmezatbcdidotcom
Fri Feb 4 23:14:02 EST 2005


"Mick Krippendorf" <mad.mick at gmx.de> wrote in message 
news:36iv03F4urakqU1 at individual.net...
> Fahri Basegmez wrote:
>> reduce(lambda x, y: x or y, lst)
>
> This doesn't solve the OPs problem since
>
> >>> reduce(lambda x, y: x or y, [False, None])
>
> returns None instead of False.
>
> Mick.
>

You are right.
I tested None or False and it worked. I assumed order did not matter for or 
operator.

None or False returns False
False or None returns None

You know what they say about assumptions. Live and learn.

Fahri





More information about the Python-list mailing list