4 ms·
> 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-elemen
by tempguy9999 7y ago
> 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-elements-of-a-python-list-are-false> https://stackoverflow.com/questions/31099561/test-if-all-ele.... More general (see my other post), shorter and clearer?
- dagw 7y agoOften I want to know how many items are True, not just if all/some/none are True.
- wodenokoto 7y agoI 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.