returning True, False or None

Christos TZOTZIOY Georgiou tzot at sil-tec.gr
Sat Feb 5 04:06:58 EST 2005


On Fri, 04 Feb 2005 13:04:16 -0500, rumours say that Steve Holden
<steve at holdenweb.com> might have written:

[STeVe]
>> For a given list:
>> * If all values are None, the function should return None.
>> * If at least one value is True, the function should return True.
>> * Otherwise, the function should return False.

[Stevbe]
>If you wanted to get clever you could write something like
>
>for i in True, False:
>   if i in lst:
>     return i
>return False

[!Steve]

You mistyped None as False in the last line.  Your typos are getting worse every
day :)
-- 
TZOTZIOY, I speak England very best.
"Be strict when sending and tolerant when receiving." (from RFC1958)
I really should keep that in mind when talking with people, actually...



More information about the Python-list mailing list