News for hackers. Stuff that matters.
Re:Common mistakes made by beginner Python programmers by tempguy9999 on Monday July 01, 2019 @05:05AM (#20323626)
> I sum my booleans all the time in python, but other than that I agree.

Use any/all instead? <https://stackoverflow.com/questions/31099561/test-if-all-ele.... More general (see my other post), shorter and clearer?

Re:Common mistakes made by beginner Python programmers by wodenokoto on Monday July 01, 2019 @12:33PM (#20327025)
I get my averages from

    sum(list_of_bools) / len(list_of_bools)
and

    np_array_of_bools.mean()
There is probably a more correct way, but I enjoy it.
Re:Common mistakes made by beginner Python programmers by dagw on Monday July 01, 2019 @05:08AM (#20323637)
Often I want to know how many items are True, not just if all/some/none are True.