simultaneous assignment
Grant Edwards
grante at visi.com
Tue May 2 15:28:16 EDT 2006
On 2006-05-02, John Salerno <johnjsal at NOSPAMgmail.com> wrote:
>> Python knows how to count. :)
>>
>> def countFalse(seq):
>> return len([v for v in seq if not v])
>>
>> def countTrue(seq):
>> return len([v for v in seq if v])
>>
>> def truth_test(seq):
>> return countTrue(seq) == 1
>
> Gosh, so much to learn! Of course, I already know all about list
> comprehensions, but now I just need to learn to *use* them! :)
That's the part that takes a while...
--
Grant Edwards grante Yow! Is this "BOOZE"?
at
visi.com
More information about the Python-list
mailing list