On Tue, 02 May 2006 17:15:05 GMT, rumours say that John Salerno <[EMAIL PROTECTED]> might have written:
>Another thing I'm trying to do is write a function that tests to see if >a list contains exactly one true item, and the rest are false (obviously >this would have to be a list of boolean values, I guess). I'm sure this >isn't a handy utility, but I enjoy figuring out how to implement it. >>> def true_count_is(predicates, count): return count == sum(map(bool, predicates)) >>> true_count_is([True, True, False], 1) False >>> true_count_is([True, False, False], 1) True -- TZOTZIOY, I speak England very best. "Dear Paul, please stop spamming us." The Corinthians -- http://mail.python.org/mailman/listinfo/python-list