returning True, False or None

Steve Holden steve at holdenweb.com
Sat Feb 5 08:16:22 EST 2005


Steve Holden wrote:

> Christos TZOTZIOY Georgiou wrote:
> 
>> 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 :)
> 
> 
> That wasn't a *type*, it was a *thinko*
> 
> regards
>  Steve

Sheesh, now I even make typos typing about typos ...

giving-up-on-the-spill-chocker-ly y'rs  - steve
-- 
Meet the Python developers and your c.l.py favorites March 23-25
Come to PyCon DC 2005                      http://www.pycon.org/
Steve Holden                           http://www.holdenweb.com/



More information about the Python-list mailing list